diff options
author | gareth | 2007-05-07 16:32:30 +0000 |
---|---|---|
committer | gareth | 2007-05-07 16:32:30 +0000 |
commit | 3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1 (patch) | |
tree | 5d6b1009685278b214100a7901bd4feaeed584da /OpenSim.RegionServer/OpenSimMain.cs | |
parent | Updated to have uniform build number (diff) | |
download | opensim-SC-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.zip opensim-SC-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.tar.gz opensim-SC-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.tar.bz2 opensim-SC-3de3d8bb3ba9b0781a2078c8698816ae5b72f7b1.tar.xz |
Merged 0.1-prestable back into trunk :(
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 137 |
1 files changed, 94 insertions, 43 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index 61441b2..1fd24b7 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -150,12 +150,28 @@ namespace OpenSim | |||
150 | m_console.WriteLine("Starting in Grid mode"); | 150 | m_console.WriteLine("Starting in Grid mode"); |
151 | } | 151 | } |
152 | 152 | ||
153 | GridServers.Initialise(); | 153 | try |
154 | { | ||
155 | GridServers.Initialise(); | ||
156 | } | ||
157 | catch (Exception e) | ||
158 | { | ||
159 | m_console.WriteLine(e.Message + "\nSorry, could not setup the grid interface"); | ||
160 | Environment.Exit(1); | ||
161 | } | ||
154 | 162 | ||
155 | startuptime = DateTime.Now; | 163 | startuptime = DateTime.Now; |
156 | 164 | ||
157 | AssetCache = new AssetCache(GridServers.AssetServer); | 165 | try |
158 | InventoryCache = new InventoryCache(); | 166 | { |
167 | AssetCache = new AssetCache(GridServers.AssetServer); | ||
168 | InventoryCache = new InventoryCache(); | ||
169 | } | ||
170 | catch (Exception e) | ||
171 | { | ||
172 | m_console.WriteLine(e.Message + "\nSorry, could not setup local cache"); | ||
173 | Environment.Exit(1); | ||
174 | } | ||
159 | 175 | ||
160 | PacketServer packetServer = new PacketServer(this); | 176 | PacketServer packetServer = new PacketServer(this); |
161 | 177 | ||
@@ -189,9 +205,17 @@ namespace OpenSim | |||
189 | { | 205 | { |
190 | // The grid server has told us who we are | 206 | // The grid server has told us who we are |
191 | // We must obey the grid server. | 207 | // We must obey the grid server. |
192 | regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); | 208 | try |
193 | regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); | 209 | { |
194 | regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); | 210 | regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); |
211 | regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); | ||
212 | regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); | ||
213 | } | ||
214 | catch (Exception e) | ||
215 | { | ||
216 | m_console.WriteLine(e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!"); | ||
217 | Environment.Exit(1); | ||
218 | } | ||
195 | } | 219 | } |
196 | 220 | ||
197 | } | 221 | } |
@@ -234,6 +258,7 @@ namespace OpenSim | |||
234 | if (gridServer.GetName() == "Remote") | 258 | if (gridServer.GetName() == "Remote") |
235 | { | 259 | { |
236 | // should startup the OGS protocol server here | 260 | // should startup the OGS protocol server here |
261 | // Are we actually using this? | ||
237 | OGSServer = new OpenGridProtocolServer(this.regionData.IPListenPort - 500); // Changed so we can have more than one OGSServer per machine. | 262 | OGSServer = new OpenGridProtocolServer(this.regionData.IPListenPort - 500); // Changed so we can have more than one OGSServer per machine. |
238 | 263 | ||
239 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server | 264 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server |
@@ -347,7 +372,7 @@ namespace OpenSim | |||
347 | // SandBoxMode | 372 | // SandBoxMode |
348 | string attri = ""; | 373 | string attri = ""; |
349 | attri = configData.GetAttribute("SandBox"); | 374 | attri = configData.GetAttribute("SandBox"); |
350 | if (attri == "") | 375 | if ((attri == "") || ((attri != "false") && (attri != "true"))) |
351 | { | 376 | { |
352 | this.m_sandbox = false; | 377 | this.m_sandbox = false; |
353 | configData.SetAttribute("SandBox", "false"); | 378 | configData.SetAttribute("SandBox", "false"); |
@@ -360,7 +385,7 @@ namespace OpenSim | |||
360 | // LoginServer | 385 | // LoginServer |
361 | attri = ""; | 386 | attri = ""; |
362 | attri = configData.GetAttribute("LoginServer"); | 387 | attri = configData.GetAttribute("LoginServer"); |
363 | if (attri == "") | 388 | if ((attri == "") || ((attri != "false") && (attri != "true"))) |
364 | { | 389 | { |
365 | this.m_loginserver = false; | 390 | this.m_loginserver = false; |
366 | configData.SetAttribute("LoginServer", "false"); | 391 | configData.SetAttribute("LoginServer", "false"); |
@@ -373,12 +398,12 @@ namespace OpenSim | |||
373 | // Sandbox User accounts | 398 | // Sandbox User accounts |
374 | attri = ""; | 399 | attri = ""; |
375 | attri = configData.GetAttribute("UserAccount"); | 400 | attri = configData.GetAttribute("UserAccount"); |
376 | if (attri == "") | 401 | if ((attri == "") || ((attri != "false") && (attri != "true"))) |
377 | { | 402 | { |
378 | this.user_accounts = false; | 403 | this.user_accounts = false; |
379 | configData.SetAttribute("UserAccounts", "false"); | 404 | configData.SetAttribute("UserAccounts", "false"); |
380 | } | 405 | } |
381 | else | 406 | else if (attri == "true") |
382 | { | 407 | { |
383 | this.user_accounts = Convert.ToBoolean(attri); | 408 | this.user_accounts = Convert.ToBoolean(attri); |
384 | } | 409 | } |
@@ -386,70 +411,96 @@ namespace OpenSim | |||
386 | // Grid mode hack to use local asset server | 411 | // Grid mode hack to use local asset server |
387 | attri = ""; | 412 | attri = ""; |
388 | attri = configData.GetAttribute("LocalAssets"); | 413 | attri = configData.GetAttribute("LocalAssets"); |
389 | if (attri == "") | 414 | if ((attri == "") || ((attri != "false") && (attri != "true"))) |
390 | { | 415 | { |
391 | this.gridLocalAsset = false; | 416 | this.gridLocalAsset = false; |
392 | configData.SetAttribute("LocalAssets", "false"); | 417 | configData.SetAttribute("LocalAssets", "false"); |
393 | } | 418 | } |
394 | else | 419 | else if (attri == "true") |
395 | { | 420 | { |
396 | this.gridLocalAsset = Convert.ToBoolean(attri); | 421 | this.gridLocalAsset = Convert.ToBoolean(attri); |
397 | } | 422 | } |
398 | 423 | ||
399 | // Grid mode hack to use local asset server | 424 | |
400 | attri = ""; | 425 | attri = ""; |
401 | attri = configData.GetAttribute("PhysicsEngine"); | 426 | attri = configData.GetAttribute("PhysicsEngine"); |
402 | if (attri == "") | 427 | switch (attri) |
403 | { | ||
404 | this.m_physicsEngine = "basicphysics"; | ||
405 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
406 | } | ||
407 | else | ||
408 | { | 428 | { |
409 | this.m_physicsEngine = attri; | 429 | default: |
410 | if ((attri == "RealPhysX") || (attri == "OpenDynamicsEngine")) | 430 | m_console.WriteLine("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); |
411 | { | 431 | Environment.Exit(1); |
412 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | 432 | break; |
413 | } | 433 | |
414 | else | 434 | case "": |
415 | { | 435 | this.m_physicsEngine = "basicphysics"; |
436 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
416 | OpenSim.world.Avatar.PhysicsEngineFlying = false; | 437 | OpenSim.world.Avatar.PhysicsEngineFlying = false; |
417 | } | 438 | break; |
439 | |||
440 | case "basicphysics": | ||
441 | this.m_physicsEngine = "basicphysics"; | ||
442 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
443 | OpenSim.world.Avatar.PhysicsEngineFlying = false; | ||
444 | break; | ||
445 | |||
446 | case "RealPhysX": | ||
447 | this.m_physicsEngine = "RealPhysX"; | ||
448 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | ||
449 | break; | ||
450 | |||
451 | case "OpenDynamicsEngine": | ||
452 | this.m_physicsEngine = "OpenDynamicsEngine"; | ||
453 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | ||
454 | break; | ||
418 | } | 455 | } |
456 | |||
419 | configData.Commit(); | 457 | configData.Commit(); |
420 | } | 458 | } |
421 | catch (Exception e) | 459 | catch (Exception e) |
422 | { | 460 | { |
423 | Console.WriteLine(e.Message); | 461 | Console.WriteLine(e.Message); |
462 | Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data"); | ||
463 | Console.WriteLine("Can not continue starting up"); | ||
464 | Environment.Exit(1); | ||
424 | } | 465 | } |
425 | } | 466 | } |
426 | 467 | ||
427 | private SimConfig LoadConfigDll(string dllName) | 468 | private SimConfig LoadConfigDll(string dllName) |
428 | { | 469 | { |
429 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 470 | try |
430 | SimConfig config = null; | ||
431 | |||
432 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
433 | { | 471 | { |
434 | if (pluginType.IsPublic) | 472 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
473 | SimConfig config = null; | ||
474 | |||
475 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
435 | { | 476 | { |
436 | if (!pluginType.IsAbstract) | 477 | if (pluginType.IsPublic) |
437 | { | 478 | { |
438 | Type typeInterface = pluginType.GetInterface("ISimConfig", true); | 479 | if (!pluginType.IsAbstract) |
439 | |||
440 | if (typeInterface != null) | ||
441 | { | 480 | { |
442 | ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 481 | Type typeInterface = pluginType.GetInterface("ISimConfig", true); |
443 | config = plug.GetConfigObject(); | ||
444 | break; | ||
445 | } | ||
446 | 482 | ||
447 | typeInterface = null; | 483 | if (typeInterface != null) |
484 | { | ||
485 | ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
486 | config = plug.GetConfigObject(); | ||
487 | break; | ||
488 | } | ||
489 | |||
490 | typeInterface = null; | ||
491 | } | ||
448 | } | 492 | } |
449 | } | 493 | } |
494 | pluginAssembly = null; | ||
495 | return config; | ||
496 | } | ||
497 | catch (Exception e) | ||
498 | { | ||
499 | m_console.WriteLine(e.Message + "\nSorry, a fatal error occurred while trying to load the config DLL"); | ||
500 | m_console.WriteLine("Can not continue starting up"); | ||
501 | Environment.Exit(1); | ||
502 | return null; | ||
450 | } | 503 | } |
451 | pluginAssembly = null; | ||
452 | return config; | ||
453 | } | 504 | } |
454 | 505 | ||
455 | private void OnReceivedData(IAsyncResult result) | 506 | private void OnReceivedData(IAsyncResult result) |