* Added maintenance patch (issue #139) from BigfootAg to /trunk
parent
c8db62e0e4
commit
16b43b8bff
|
@ -113,6 +113,9 @@
|
||||||
<Compile Include="LoginServer.cs">
|
<Compile Include="LoginServer.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="SocketRegistry.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UDPServerBase.cs">
|
<Compile Include="UDPServerBase.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<include name="LocalUserProfileManager.cs" />
|
<include name="LocalUserProfileManager.cs" />
|
||||||
<include name="LoginResponse.cs" />
|
<include name="LoginResponse.cs" />
|
||||||
<include name="LoginServer.cs" />
|
<include name="LoginServer.cs" />
|
||||||
|
<include name="SocketRegistry.cs" />
|
||||||
<include name="UDPServerBase.cs" />
|
<include name="UDPServerBase.cs" />
|
||||||
<include name="XmlRpcMethod.cs" />
|
<include name="XmlRpcMethod.cs" />
|
||||||
</sources>
|
</sources>
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Created by SharpDevelop.
|
||||||
|
* User: Adam Stevenson
|
||||||
|
* Date: 6/13/2007
|
||||||
|
* Time: 12:55 AM
|
||||||
|
*
|
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
|
||||||
|
namespace OpenSim.Servers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class SocketRegistry
|
||||||
|
{
|
||||||
|
static List<Socket> _Sockets;
|
||||||
|
|
||||||
|
static SocketRegistry()
|
||||||
|
{
|
||||||
|
_Sockets = new List<Socket>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private SocketRegistry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Register(Socket pSocket)
|
||||||
|
{
|
||||||
|
_Sockets.Add(pSocket);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Unregister(Socket pSocket)
|
||||||
|
{
|
||||||
|
_Sockets.Remove(pSocket);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UnregisterAllAndClose()
|
||||||
|
{
|
||||||
|
int iSockets = _Sockets.Count;
|
||||||
|
|
||||||
|
for (int i = 0; i < iSockets; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_Sockets[i].Close();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_Sockets.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -78,6 +78,13 @@ namespace OpenSim.Servers
|
||||||
|
|
||||||
ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
|
ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
|
||||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
|
|
||||||
|
/// Add this new socket to the list of sockets that was opened by the application. When the application
|
||||||
|
/// closes, either gracefully or not, all sockets can be cleaned up. Right now I am not aware of any method
|
||||||
|
/// to get all of the sockets for a process within .NET, but if so, this process can be refactored, as
|
||||||
|
/// socket registration would not be neccessary.
|
||||||
|
SocketRegistry.Register(Server);
|
||||||
|
|
||||||
Server.Bind(ServerIncoming);
|
Server.Bind(ServerIncoming);
|
||||||
|
|
||||||
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
ipeSender = new IPEndPoint(IPAddress.Any, 0);
|
||||||
|
@ -93,3 +100,4 @@ namespace OpenSim.Servers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
</lib>
|
</lib>
|
||||||
<include name="../../../bin/Db4objects.Db4o.dll" />
|
<include name="../../../bin/Db4objects.Db4o.dll" />
|
||||||
<include name="../../../bin/libsecondlife.dll" />
|
<include name="../../../bin/libsecondlife.dll" />
|
||||||
<include name="../../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll" />
|
||||||
<include name="../../../bin/OpenSim.Framework.Console.dll" />
|
<include name="OpenSim.Framework.Console.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="System.Data.dll.dll" />
|
<include name="System.Data.dll.dll" />
|
||||||
<include name="System.Xml.dll" />
|
<include name="System.Xml.dll" />
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
<include name="${project::get-base-directory()}/${build.dir}" />
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
</lib>
|
</lib>
|
||||||
<include name="../../bin/libsecondlife.dll" />
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll.dll" />
|
||||||
<include name="../../bin/OpenSim.Servers.dll" />
|
<include name="OpenSim.Servers.dll.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="../../bin/XMLRPC.dll" />
|
<include name="XMLRPC.dll" />
|
||||||
</references>
|
</references>
|
||||||
</csc>
|
</csc>
|
||||||
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
</lib>
|
</lib>
|
||||||
<include name="../../bin/Db4objects.Db4o.dll" />
|
<include name="../../bin/Db4objects.Db4o.dll" />
|
||||||
<include name="../../bin/libsecondlife.dll" />
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.Console.dll" />
|
<include name="OpenSim.Framework.Console.dll" />
|
||||||
<include name="../../bin/OpenSim.GridInterfaces.Local.dll" />
|
<include name="OpenSim.GridInterfaces.Local.dll" />
|
||||||
<include name="../../bin/OpenSim.Servers.dll" />
|
<include name="OpenSim.Servers.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="System.Data.dll" />
|
<include name="System.Data.dll" />
|
||||||
<include name="System.Xml.dll" />
|
<include name="System.Xml.dll" />
|
||||||
<include name="../../bin/XMLRPC.dll" />
|
<include name="XMLRPC.dll" />
|
||||||
</references>
|
</references>
|
||||||
</csc>
|
</csc>
|
||||||
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
|
|
@ -24,14 +24,14 @@
|
||||||
<include name="../../bin/libsecondlife.dll" />
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
<include name="../../bin/OpenGrid.Framework.Data.dll" />
|
<include name="../../bin/OpenGrid.Framework.Data.dll" />
|
||||||
<include name="../../bin/OpenGrid.Framework.Manager.dll" />
|
<include name="../../bin/OpenGrid.Framework.Manager.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.Console.dll" />
|
<include name="OpenSim.Framework.Console.dll" />
|
||||||
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
|
<include name="OpenSim.GenericConfig.Xml.dll" />
|
||||||
<include name="../../bin/OpenSim.Servers.dll" />
|
<include name="OpenSim.Servers.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="System.Data.dll" />
|
<include name="System.Data.dll" />
|
||||||
<include name="System.Xml.dll" />
|
<include name="System.Xml.dll" />
|
||||||
<include name="../../bin/XMLRPC.dll" />
|
<include name="XMLRPC.dll" />
|
||||||
</references>
|
</references>
|
||||||
</csc>
|
</csc>
|
||||||
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ReferencePath>C:\Documents and Settings\Stefan\My Documents\source\opensim\trunk\bin\</ReferencePath>
|
<ReferencePath>E:\work\oslauth\sim\trunk\bin\</ReferencePath>
|
||||||
<LastOpenVersion>8.0.50727</LastOpenVersion>
|
<LastOpenVersion>8.0.50727</LastOpenVersion>
|
||||||
<ProjectView>ProjectFiles</ProjectView>
|
<ProjectView>ProjectFiles</ProjectView>
|
||||||
<ProjectTrust>0</ProjectTrust>
|
<ProjectTrust>0</ProjectTrust>
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
<include name="../../bin/Db4objects.Db4o.dll" />
|
<include name="../../bin/Db4objects.Db4o.dll" />
|
||||||
<include name="../../bin/libsecondlife.dll" />
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
<include name="../../bin/OpenGrid.Framework.Data.dll" />
|
<include name="../../bin/OpenGrid.Framework.Data.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.Console.dll" />
|
<include name="OpenSim.Framework.Console.dll" />
|
||||||
<include name="../../bin/OpenSim.GridInterfaces.Local.dll" />
|
<include name="OpenSim.GridInterfaces.Local.dll" />
|
||||||
<include name="../../bin/OpenSim.Servers.dll" />
|
<include name="OpenSim.Servers.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="System.Data.dll" />
|
<include name="System.Data.dll" />
|
||||||
<include name="System.Xml.dll" />
|
<include name="System.Xml.dll" />
|
||||||
<include name="../../bin/XMLRPC.dll" />
|
<include name="XMLRPC.dll" />
|
||||||
</references>
|
</references>
|
||||||
</csc>
|
</csc>
|
||||||
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
<include name="../../bin/Db4objects.Db4o.dll" />
|
<include name="../../bin/Db4objects.Db4o.dll" />
|
||||||
<include name="../../bin/libsecondlife.dll" />
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
<include name="../../bin/OpenGrid.Framework.Data.dll" />
|
<include name="../../bin/OpenGrid.Framework.Data.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.Console.dll" />
|
<include name="OpenSim.Framework.Console.dll" />
|
||||||
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
|
<include name="OpenSim.GenericConfig.Xml.dll" />
|
||||||
<include name="../../bin/OpenSim.Servers.dll" />
|
<include name="OpenSim.Servers.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="System.Data.dll" />
|
<include name="System.Data.dll" />
|
||||||
<include name="System.Xml.dll" />
|
<include name="System.Xml.dll" />
|
||||||
<include name="../../bin/XMLRPC.dll" />
|
<include name="XMLRPC.dll" />
|
||||||
</references>
|
</references>
|
||||||
</csc>
|
</csc>
|
||||||
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
</lib>
|
</lib>
|
||||||
<include name="../../../bin/Db4objects.Db4o.dll" />
|
<include name="../../../bin/Db4objects.Db4o.dll" />
|
||||||
<include name="../../../bin/libsecondlife.dll" />
|
<include name="../../../bin/libsecondlife.dll" />
|
||||||
<include name="../../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll" />
|
||||||
<include name="../../../bin/OpenSim.Framework.Console.dll" />
|
<include name="OpenSim.Framework.Console.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="System.Data.dll.dll" />
|
<include name="System.Data.dll.dll" />
|
||||||
<include name="System.Xml.dll" />
|
<include name="System.Xml.dll" />
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
<include name="${project::get-base-directory()}/${build.dir}" />
|
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||||
</lib>
|
</lib>
|
||||||
<include name="../../bin/libsecondlife.dll" />
|
<include name="../../bin/libsecondlife.dll" />
|
||||||
<include name="../../bin/OpenSim.Framework.dll" />
|
<include name="OpenSim.Framework.dll.dll" />
|
||||||
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
|
<include name="OpenSim.GenericConfig.Xml.dll" />
|
||||||
<include name="System.dll" />
|
<include name="System.dll" />
|
||||||
<include name="System.ServiceProcess.dll" />
|
<include name="System.ServiceProcess.dll" />
|
||||||
<include name="System.Xml.dll" />
|
<include name="System.Xml.dll" />
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace OpenSim.RegionServer
|
||||||
public class UDPServer : OpenSimNetworkHandler
|
public class UDPServer : OpenSimNetworkHandler
|
||||||
{
|
{
|
||||||
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
||||||
public Socket Server;
|
private Socket Server;
|
||||||
protected IPEndPoint ServerIncoming;
|
protected IPEndPoint ServerIncoming;
|
||||||
protected byte[] RecvBuffer = new byte[4096];
|
protected byte[] RecvBuffer = new byte[4096];
|
||||||
protected byte[] ZeroBuffer = new byte[8192];
|
protected byte[] ZeroBuffer = new byte[8192];
|
||||||
|
@ -201,6 +201,13 @@ namespace OpenSim.RegionServer
|
||||||
|
|
||||||
ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
|
ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
|
||||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
|
|
||||||
|
/// Add this new socket to the list of sockets that was opened by the application. When the application
|
||||||
|
/// closes, either gracefully or not, all sockets can be cleaned up. Right now I am not aware of any method
|
||||||
|
/// to get all of the sockets for a process within .NET, but if so, this process can be refactored, as
|
||||||
|
/// socket registration would not be neccessary.
|
||||||
|
SocketRegistry.Register(Server);
|
||||||
|
|
||||||
Server.Bind(ServerIncoming);
|
Server.Bind(ServerIncoming);
|
||||||
|
|
||||||
m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen");
|
m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen");
|
||||||
|
|
|
@ -40,6 +40,8 @@ namespace OpenSim
|
||||||
//could move our main function into OpenSimMain and kill this class
|
//could move our main function into OpenSimMain and kill this class
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
|
||||||
Console.WriteLine("Starting...\n");
|
Console.WriteLine("Starting...\n");
|
||||||
|
@ -121,5 +123,22 @@ namespace OpenSim
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
|
OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception oException)
|
||||||
|
{
|
||||||
|
Console.WriteLine(oException.Message);
|
||||||
|
Console.WriteLine("Fatal error. Server is shutdown. Press 'Enter' to close.");
|
||||||
|
Console.ReadLine();
|
||||||
|
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
/// Ensure that all sockets have been closed before the process closes. This helps ensure that no
|
||||||
|
/// open ports are left open on process that '<do not exist>'. This is in the finally block, as it
|
||||||
|
/// should be done regardless of whether a exception closes the application, or if the application
|
||||||
|
/// is closed normally.
|
||||||
|
|
||||||
|
OpenSim.Servers.SocketRegistry.UnregisterAllAndClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue