aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common
diff options
context:
space:
mode:
authorAdam Frisby2007-06-14 14:36:40 +0000
committerAdam Frisby2007-06-14 14:36:40 +0000
commit16b43b8bffff8f11f0f633d8f503e752223a4772 (patch)
treea4c4081d2ebc1bd24ff23ea18527891b206acf90 /Common
parentFixed the bug that makes a region use its water height as its name (in region... (diff)
downloadopensim-SC_OLD-16b43b8bffff8f11f0f633d8f503e752223a4772.zip
opensim-SC_OLD-16b43b8bffff8f11f0f633d8f503e752223a4772.tar.gz
opensim-SC_OLD-16b43b8bffff8f11f0f633d8f503e752223a4772.tar.bz2
opensim-SC_OLD-16b43b8bffff8f11f0f633d8f503e752223a4772.tar.xz
* Added maintenance patch (issue #139) from BigfootAg to /trunk
Diffstat (limited to '')
-rw-r--r--Common/OpenSim.Servers/OpenSim.Servers.csproj3
-rw-r--r--Common/OpenSim.Servers/OpenSim.Servers.dll.build1
-rw-r--r--Common/OpenSim.Servers/SocketRegistry.cs63
-rw-r--r--Common/OpenSim.Servers/UDPServerBase.cs8
4 files changed, 75 insertions, 0 deletions
diff --git a/Common/OpenSim.Servers/OpenSim.Servers.csproj b/Common/OpenSim.Servers/OpenSim.Servers.csproj
index a4f56fe..7a99206 100644
--- a/Common/OpenSim.Servers/OpenSim.Servers.csproj
+++ b/Common/OpenSim.Servers/OpenSim.Servers.csproj
@@ -113,6 +113,9 @@
113 <Compile Include="LoginServer.cs"> 113 <Compile Include="LoginServer.cs">
114 <SubType>Code</SubType> 114 <SubType>Code</SubType>
115 </Compile> 115 </Compile>
116 <Compile Include="SocketRegistry.cs">
117 <SubType>Code</SubType>
118 </Compile>
116 <Compile Include="UDPServerBase.cs"> 119 <Compile Include="UDPServerBase.cs">
117 <SubType>Code</SubType> 120 <SubType>Code</SubType>
118 </Compile> 121 </Compile>
diff --git a/Common/OpenSim.Servers/OpenSim.Servers.dll.build b/Common/OpenSim.Servers/OpenSim.Servers.dll.build
index 25bcd65..6147ea7 100644
--- a/Common/OpenSim.Servers/OpenSim.Servers.dll.build
+++ b/Common/OpenSim.Servers/OpenSim.Servers.dll.build
@@ -18,6 +18,7 @@
18 <include name="LocalUserProfileManager.cs" /> 18 <include name="LocalUserProfileManager.cs" />
19 <include name="LoginResponse.cs" /> 19 <include name="LoginResponse.cs" />
20 <include name="LoginServer.cs" /> 20 <include name="LoginServer.cs" />
21 <include name="SocketRegistry.cs" />
21 <include name="UDPServerBase.cs" /> 22 <include name="UDPServerBase.cs" />
22 <include name="XmlRpcMethod.cs" /> 23 <include name="XmlRpcMethod.cs" />
23 </sources> 24 </sources>
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
10using System;
11using System.Collections.Generic;
12using System.Net;
13using System.Net.Sockets;
14
15namespace 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}
diff --git a/Common/OpenSim.Servers/UDPServerBase.cs b/Common/OpenSim.Servers/UDPServerBase.cs
index b472c97..b763315 100644
--- a/Common/OpenSim.Servers/UDPServerBase.cs
+++ b/Common/OpenSim.Servers/UDPServerBase.cs
@@ -78,6 +78,13 @@ namespace OpenSim.Servers
78 78
79 ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); 79 ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
80 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 80 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
81
82 /// Add this new socket to the list of sockets that was opened by the application. When the application
83 /// closes, either gracefully or not, all sockets can be cleaned up. Right now I am not aware of any method
84 /// to get all of the sockets for a process within .NET, but if so, this process can be refactored, as
85 /// socket registration would not be neccessary.
86 SocketRegistry.Register(Server);
87
81 Server.Bind(ServerIncoming); 88 Server.Bind(ServerIncoming);
82 89
83 ipeSender = new IPEndPoint(IPAddress.Any, 0); 90 ipeSender = new IPEndPoint(IPAddress.Any, 0);
@@ -93,3 +100,4 @@ namespace OpenSim.Servers
93 } 100 }
94} 101}
95 102
103