diff options
author | Adam Frisby | 2007-06-14 14:36:40 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-14 14:36:40 +0000 |
commit | 16b43b8bffff8f11f0f633d8f503e752223a4772 (patch) | |
tree | a4c4081d2ebc1bd24ff23ea18527891b206acf90 /Common/OpenSim.Servers/SocketRegistry.cs | |
parent | Fixed the bug that makes a region use its water height as its name (in region... (diff) | |
download | opensim-SC-16b43b8bffff8f11f0f633d8f503e752223a4772.zip opensim-SC-16b43b8bffff8f11f0f633d8f503e752223a4772.tar.gz opensim-SC-16b43b8bffff8f11f0f633d8f503e752223a4772.tar.bz2 opensim-SC-16b43b8bffff8f11f0f633d8f503e752223a4772.tar.xz |
* Added maintenance patch (issue #139) from BigfootAg to /trunk
Diffstat (limited to 'Common/OpenSim.Servers/SocketRegistry.cs')
-rw-r--r-- | Common/OpenSim.Servers/SocketRegistry.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Common/OpenSim.Servers/SocketRegistry.cs b/Common/OpenSim.Servers/SocketRegistry.cs new file mode 100644 index 0000000..2ebf80c --- /dev/null +++ b/Common/OpenSim.Servers/SocketRegistry.cs | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Created by SharpDevelop. | ||
3 | * User: Adam Stevenson | ||
4 | * Date: 6/13/2007 | ||
5 | * Time: 12:55 AM | ||
6 | * | ||
7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. | ||
8 | */ | ||
9 | |||
10 | using System; | ||
11 | using System.Collections.Generic; | ||
12 | using System.Net; | ||
13 | using System.Net.Sockets; | ||
14 | |||
15 | namespace OpenSim.Servers | ||
16 | { | ||
17 | /// <summary> | ||
18 | /// | ||
19 | /// </summary> | ||
20 | public class SocketRegistry | ||
21 | { | ||
22 | static List<Socket> _Sockets; | ||
23 | |||
24 | static SocketRegistry() | ||
25 | { | ||
26 | _Sockets = new List<Socket>(); | ||
27 | } | ||
28 | |||
29 | private SocketRegistry() | ||
30 | { | ||
31 | |||
32 | } | ||
33 | |||
34 | public static void Register(Socket pSocket) | ||
35 | { | ||
36 | _Sockets.Add(pSocket); | ||
37 | } | ||
38 | |||
39 | public static void Unregister(Socket pSocket) | ||
40 | { | ||
41 | _Sockets.Remove(pSocket); | ||
42 | } | ||
43 | |||
44 | public static void UnregisterAllAndClose() | ||
45 | { | ||
46 | int iSockets = _Sockets.Count; | ||
47 | |||
48 | for (int i = 0; i < iSockets; i++) | ||
49 | { | ||
50 | try | ||
51 | { | ||
52 | _Sockets[i].Close(); | ||
53 | } | ||
54 | catch | ||
55 | { | ||
56 | |||
57 | } | ||
58 | } | ||
59 | |||
60 | _Sockets.Clear(); | ||
61 | } | ||
62 | } | ||
63 | } | ||