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 /OpenSim | |
parent | Fixed the bug that makes a region use its water height as its name (in region... (diff) | |
download | opensim-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 'OpenSim')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/UDPServer.cs | 11 | ||||
-rw-r--r-- | OpenSim/OpenSim/Application.cs | 153 |
2 files changed, 95 insertions, 69 deletions
diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs index f0d3367..ae62607 100644 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.RegionServer | |||
61 | public class UDPServer : OpenSimNetworkHandler | 61 | public class UDPServer : OpenSimNetworkHandler |
62 | { | 62 | { |
63 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | 63 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); |
64 | public Socket Server; | 64 | private Socket Server; |
65 | protected IPEndPoint ServerIncoming; | 65 | protected IPEndPoint ServerIncoming; |
66 | protected byte[] RecvBuffer = new byte[4096]; | 66 | protected byte[] RecvBuffer = new byte[4096]; |
67 | protected byte[] ZeroBuffer = new byte[8192]; | 67 | protected byte[] ZeroBuffer = new byte[8192]; |
@@ -201,6 +201,13 @@ namespace OpenSim.RegionServer | |||
201 | 201 | ||
202 | ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); | 202 | ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); |
203 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | 203 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
204 | |||
205 | /// Add this new socket to the list of sockets that was opened by the application. When the application | ||
206 | /// closes, either gracefully or not, all sockets can be cleaned up. Right now I am not aware of any method | ||
207 | /// to get all of the sockets for a process within .NET, but if so, this process can be refactored, as | ||
208 | /// socket registration would not be neccessary. | ||
209 | SocketRegistry.Register(Server); | ||
210 | |||
204 | Server.Bind(ServerIncoming); | 211 | Server.Bind(ServerIncoming); |
205 | 212 | ||
206 | m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); | 213 | m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); |
@@ -255,4 +262,4 @@ namespace OpenSim.RegionServer | |||
255 | return this.AuthenticateHandler(sessionID, agentID, circuitCode); | 262 | return this.AuthenticateHandler(sessionID, agentID, circuitCode); |
256 | } | 263 | } |
257 | } | 264 | } |
258 | } \ No newline at end of file | 265 | } |
diff --git a/OpenSim/OpenSim/Application.cs b/OpenSim/OpenSim/Application.cs index e3b23ad..15fcd93 100644 --- a/OpenSim/OpenSim/Application.cs +++ b/OpenSim/OpenSim/Application.cs | |||
@@ -41,84 +41,103 @@ namespace OpenSim | |||
41 | [STAThread] | 41 | [STAThread] |
42 | public static void Main(string[] args) | 42 | public static void Main(string[] args) |
43 | { | 43 | { |
44 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); | 44 | try |
45 | Console.WriteLine("Starting...\n"); | ||
46 | |||
47 | bool sandBoxMode = false; | ||
48 | bool startLoginServer = false; | ||
49 | string physicsEngine = "basicphysics"; | ||
50 | bool allowFlying = false; | ||
51 | bool userAccounts = false; | ||
52 | bool gridLocalAsset = false; | ||
53 | bool useConfigFile = false; | ||
54 | bool silent = false; | ||
55 | string configFile = "simconfig.xml"; | ||
56 | |||
57 | for (int i = 0; i < args.Length; i++) | ||
58 | { | 45 | { |
59 | if (args[i] == "-sandbox") | 46 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); |
60 | { | 47 | Console.WriteLine("Starting...\n"); |
61 | sandBoxMode = true; | 48 | |
62 | userAccounts = true; | 49 | bool sandBoxMode = false; |
63 | startLoginServer = true; | 50 | bool startLoginServer = false; |
64 | } | 51 | string physicsEngine = "basicphysics"; |
65 | /* | 52 | bool allowFlying = false; |
66 | if (args[i] == "-loginserver") | 53 | bool userAccounts = false; |
67 | { | 54 | bool gridLocalAsset = false; |
68 | startLoginServer = true; | 55 | bool useConfigFile = false; |
69 | }*/ | 56 | bool silent = false; |
70 | if (args[i] == "-accounts") | 57 | string configFile = "simconfig.xml"; |
71 | { | 58 | |
72 | userAccounts = true; | 59 | for (int i = 0; i < args.Length; i++) |
73 | } | ||
74 | if (args[i] == "-realphysx") | ||
75 | { | ||
76 | physicsEngine = "RealPhysX"; | ||
77 | allowFlying = true; | ||
78 | } | ||
79 | if (args[i] == "-ode") | ||
80 | { | ||
81 | physicsEngine = "OpenDynamicsEngine"; | ||
82 | allowFlying = true; | ||
83 | } | ||
84 | if (args[i] == "-localasset") | ||
85 | { | ||
86 | gridLocalAsset = true; | ||
87 | } | ||
88 | if (args[i] == "-configfile") | ||
89 | { | ||
90 | useConfigFile = true; | ||
91 | } | ||
92 | if (args[i] == "-noverbose") | ||
93 | { | ||
94 | silent = true; | ||
95 | } | ||
96 | if (args[i] == "-config") | ||
97 | { | 60 | { |
98 | try | 61 | if (args[i] == "-sandbox") |
99 | { | 62 | { |
100 | i++; | 63 | sandBoxMode = true; |
101 | configFile = args[i]; | 64 | userAccounts = true; |
65 | startLoginServer = true; | ||
102 | } | 66 | } |
103 | catch (Exception e) | 67 | /* |
68 | if (args[i] == "-loginserver") | ||
104 | { | 69 | { |
105 | Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")"); | 70 | startLoginServer = true; |
71 | }*/ | ||
72 | if (args[i] == "-accounts") | ||
73 | { | ||
74 | userAccounts = true; | ||
75 | } | ||
76 | if (args[i] == "-realphysx") | ||
77 | { | ||
78 | physicsEngine = "RealPhysX"; | ||
79 | allowFlying = true; | ||
80 | } | ||
81 | if (args[i] == "-ode") | ||
82 | { | ||
83 | physicsEngine = "OpenDynamicsEngine"; | ||
84 | allowFlying = true; | ||
85 | } | ||
86 | if (args[i] == "-localasset") | ||
87 | { | ||
88 | gridLocalAsset = true; | ||
89 | } | ||
90 | if (args[i] == "-configfile") | ||
91 | { | ||
92 | useConfigFile = true; | ||
93 | } | ||
94 | if (args[i] == "-noverbose") | ||
95 | { | ||
96 | silent = true; | ||
97 | } | ||
98 | if (args[i] == "-config") | ||
99 | { | ||
100 | try | ||
101 | { | ||
102 | i++; | ||
103 | configFile = args[i]; | ||
104 | } | ||
105 | catch (Exception e) | ||
106 | { | ||
107 | Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")"); | ||
108 | } | ||
106 | } | 109 | } |
107 | } | 110 | } |
108 | } | ||
109 | 111 | ||
110 | OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile); | 112 | OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile); |
111 | // OpenSimRoot.Instance.Application = sim; | 113 | // OpenSimRoot.Instance.Application = sim; |
112 | sim.m_sandbox = sandBoxMode; | 114 | sim.m_sandbox = sandBoxMode; |
113 | sim.user_accounts = userAccounts; | 115 | sim.user_accounts = userAccounts; |
114 | sim.gridLocalAsset = gridLocalAsset; | 116 | sim.gridLocalAsset = gridLocalAsset; |
115 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = allowFlying; | 117 | OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = allowFlying; |
116 | 118 | ||
117 | sim.StartUp(); | 119 | sim.StartUp(); |
118 | 120 | ||
119 | while (true) | 121 | while (true) |
122 | { | ||
123 | OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt(); | ||
124 | } | ||
125 | } | ||
126 | catch (Exception oException) | ||
127 | { | ||
128 | Console.WriteLine(oException.Message); | ||
129 | Console.WriteLine("Fatal error. Server is shutdown. Press 'Enter' to close."); | ||
130 | Console.ReadLine(); | ||
131 | |||
132 | } | ||
133 | finally | ||
120 | { | 134 | { |
121 | OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt(); | 135 | /// Ensure that all sockets have been closed before the process closes. This helps ensure that no |
136 | /// open ports are left open on process that '<do not exist>'. This is in the finally block, as it | ||
137 | /// should be done regardless of whether a exception closes the application, or if the application | ||
138 | /// is closed normally. | ||
139 | |||
140 | OpenSim.Servers.SocketRegistry.UnregisterAllAndClose(); | ||
122 | } | 141 | } |
123 | } | 142 | } |
124 | } | 143 | } |