* Added maintenance patch (issue #139) from BigfootAg to /trunk

afrisby
Adam Frisby 2007-06-14 14:36:40 +00:00
parent c8db62e0e4
commit 16b43b8bff
16 changed files with 215 additions and 114 deletions

View File

@ -113,6 +113,9 @@
<Compile Include="LoginServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SocketRegistry.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="UDPServerBase.cs">
<SubType>Code</SubType>
</Compile>

View File

@ -18,6 +18,7 @@
<include name="LocalUserProfileManager.cs" />
<include name="LoginResponse.cs" />
<include name="LoginServer.cs" />
<include name="SocketRegistry.cs" />
<include name="UDPServerBase.cs" />
<include name="XmlRpcMethod.cs" />
</sources>

View File

@ -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();
}
}
}

View File

@ -78,6 +78,13 @@ namespace OpenSim.Servers
ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
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);
ipeSender = new IPEndPoint(IPAddress.Any, 0);
@ -93,3 +100,4 @@ namespace OpenSim.Servers
}
}

View File

@ -21,8 +21,8 @@
</lib>
<include name="../../../bin/Db4objects.Db4o.dll" />
<include name="../../../bin/libsecondlife.dll" />
<include name="../../../bin/OpenSim.Framework.dll" />
<include name="../../../bin/OpenSim.Framework.Console.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="System.dll" />
<include name="System.Data.dll.dll" />
<include name="System.Xml.dll" />

View File

@ -20,10 +20,10 @@
<include name="${project::get-base-directory()}/${build.dir}" />
</lib>
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="OpenSim.Framework.dll.dll" />
<include name="OpenSim.Servers.dll.dll" />
<include name="System.dll" />
<include name="../../bin/XMLRPC.dll" />
<include name="XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -22,14 +22,14 @@
</lib>
<include name="../../bin/Db4objects.Db4o.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.GridInterfaces.Local.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="OpenSim.GridInterfaces.Local.dll" />
<include name="OpenSim.Servers.dll" />
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Xml.dll" />
<include name="../../bin/XMLRPC.dll" />
<include name="XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -24,14 +24,14 @@
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/OpenGrid.Framework.Data.dll" />
<include name="../../bin/OpenGrid.Framework.Manager.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="OpenSim.GenericConfig.Xml.dll" />
<include name="OpenSim.Servers.dll" />
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Xml.dll" />
<include name="../../bin/XMLRPC.dll" />
<include name="XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<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>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>

View File

@ -22,14 +22,14 @@
<include name="../../bin/Db4objects.Db4o.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/OpenGrid.Framework.Data.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.GridInterfaces.Local.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="OpenSim.GridInterfaces.Local.dll" />
<include name="OpenSim.Servers.dll" />
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Xml.dll" />
<include name="../../bin/XMLRPC.dll" />
<include name="XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -23,14 +23,14 @@
<include name="../../bin/Db4objects.Db4o.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/OpenGrid.Framework.Data.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="OpenSim.GenericConfig.Xml.dll" />
<include name="OpenSim.Servers.dll" />
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Xml.dll" />
<include name="../../bin/XMLRPC.dll" />
<include name="XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -21,8 +21,8 @@
</lib>
<include name="../../../bin/Db4objects.Db4o.dll" />
<include name="../../../bin/libsecondlife.dll" />
<include name="../../../bin/OpenSim.Framework.dll" />
<include name="../../../bin/OpenSim.Framework.Console.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="System.dll" />
<include name="System.Data.dll.dll" />
<include name="System.Xml.dll" />

View File

@ -19,8 +19,8 @@
<include name="${project::get-base-directory()}/${build.dir}" />
</lib>
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
<include name="OpenSim.Framework.dll.dll" />
<include name="OpenSim.GenericConfig.Xml.dll" />
<include name="System.dll" />
<include name="System.ServiceProcess.dll" />
<include name="System.Xml.dll" />

View File

@ -61,7 +61,7 @@ namespace OpenSim.RegionServer
public class UDPServer : OpenSimNetworkHandler
{
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
public Socket Server;
private Socket Server;
protected IPEndPoint ServerIncoming;
protected byte[] RecvBuffer = new byte[4096];
protected byte[] ZeroBuffer = new byte[8192];
@ -201,6 +201,13 @@ namespace OpenSim.RegionServer
ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
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);
m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen");
@ -255,4 +262,4 @@ namespace OpenSim.RegionServer
return this.AuthenticateHandler(sessionID, agentID, circuitCode);
}
}
}
}

View File

@ -41,84 +41,103 @@ namespace OpenSim
[STAThread]
public static void Main(string[] args)
{
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
Console.WriteLine("Starting...\n");
bool sandBoxMode = false;
bool startLoginServer = false;
string physicsEngine = "basicphysics";
bool allowFlying = false;
bool userAccounts = false;
bool gridLocalAsset = false;
bool useConfigFile = false;
bool silent = false;
string configFile = "simconfig.xml";
for (int i = 0; i < args.Length; i++)
try
{
if (args[i] == "-sandbox")
Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
Console.WriteLine("Starting...\n");
bool sandBoxMode = false;
bool startLoginServer = false;
string physicsEngine = "basicphysics";
bool allowFlying = false;
bool userAccounts = false;
bool gridLocalAsset = false;
bool useConfigFile = false;
bool silent = false;
string configFile = "simconfig.xml";
for (int i = 0; i < args.Length; i++)
{
sandBoxMode = true;
userAccounts = true;
startLoginServer = true;
}
/*
if (args[i] == "-loginserver")
{
startLoginServer = true;
}*/
if (args[i] == "-accounts")
{
userAccounts = true;
}
if (args[i] == "-realphysx")
{
physicsEngine = "RealPhysX";
allowFlying = true;
}
if (args[i] == "-ode")
{
physicsEngine = "OpenDynamicsEngine";
allowFlying = true;
}
if (args[i] == "-localasset")
{
gridLocalAsset = true;
}
if (args[i] == "-configfile")
{
useConfigFile = true;
}
if (args[i] == "-noverbose")
{
silent = true;
}
if (args[i] == "-config")
{
try
if (args[i] == "-sandbox")
{
i++;
configFile = args[i];
sandBoxMode = true;
userAccounts = true;
startLoginServer = true;
}
catch (Exception e)
/*
if (args[i] == "-loginserver")
{
Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")");
startLoginServer = true;
}*/
if (args[i] == "-accounts")
{
userAccounts = true;
}
if (args[i] == "-realphysx")
{
physicsEngine = "RealPhysX";
allowFlying = true;
}
if (args[i] == "-ode")
{
physicsEngine = "OpenDynamicsEngine";
allowFlying = true;
}
if (args[i] == "-localasset")
{
gridLocalAsset = true;
}
if (args[i] == "-configfile")
{
useConfigFile = true;
}
if (args[i] == "-noverbose")
{
silent = true;
}
if (args[i] == "-config")
{
try
{
i++;
configFile = args[i];
}
catch (Exception e)
{
Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")");
}
}
}
OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile);
// OpenSimRoot.Instance.Application = sim;
sim.m_sandbox = sandBoxMode;
sim.user_accounts = userAccounts;
sim.gridLocalAsset = gridLocalAsset;
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = allowFlying;
sim.StartUp();
while (true)
{
OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
}
}
OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile);
// OpenSimRoot.Instance.Application = sim;
sim.m_sandbox = sandBoxMode;
sim.user_accounts = userAccounts;
sim.gridLocalAsset = gridLocalAsset;
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = allowFlying;
sim.StartUp();
while (true)
catch (Exception oException)
{
OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
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();
}
}
}

View File

@ -3,17 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 9.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Prebuild", "src\Prebuild.csproj", "{92E80C1C-0000-0000-0000-000000000000}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92E80C1C-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92E80C1C-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal