diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSimMain.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 85 |
1 files changed, 50 insertions, 35 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index b3daf0c..fa2a989 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -30,6 +30,10 @@ using System; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | ||
34 | using System.Timers; | ||
35 | using libsecondlife; | ||
36 | using Mono.Addins; | ||
33 | using Nini.Config; | 37 | using Nini.Config; |
34 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
@@ -42,9 +46,7 @@ using OpenSim.Region.Environment; | |||
42 | using OpenSim.Region.Environment.Interfaces; | 46 | using OpenSim.Region.Environment.Interfaces; |
43 | using OpenSim.Region.Environment.Scenes; | 47 | using OpenSim.Region.Environment.Scenes; |
44 | using OpenSim.Region.Physics.Manager; | 48 | using OpenSim.Region.Physics.Manager; |
45 | using libsecondlife; | 49 | using Timer=System.Timers.Timer; |
46 | using Mono.Addins; | ||
47 | using Mono.Addins.Description; | ||
48 | 50 | ||
49 | namespace OpenSim | 51 | namespace OpenSim |
50 | { | 52 | { |
@@ -86,7 +88,7 @@ namespace OpenSim | |||
86 | private string m_assetStorage = "sqlite"; | 88 | private string m_assetStorage = "sqlite"; |
87 | 89 | ||
88 | private string m_timedScript = "disabled"; | 90 | private string m_timedScript = "disabled"; |
89 | private System.Timers.Timer m_scriptTimer; | 91 | private Timer m_scriptTimer; |
90 | 92 | ||
91 | public ConsoleCommand CreateAccount = null; | 93 | public ConsoleCommand CreateAccount = null; |
92 | private bool m_dumpAssetsToFile; | 94 | private bool m_dumpAssetsToFile; |
@@ -238,7 +240,7 @@ namespace OpenSim | |||
238 | m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false); | 240 | m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false); |
239 | 241 | ||
240 | m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.DataStore.MonoSqlite.dll"); | 242 | m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.DataStore.MonoSqlite.dll"); |
241 | m_storageConnectionString | 243 | m_storageConnectionString |
242 | = startupConfig.GetString("storage_connection_string", "URI=file:OpenSim.db,version=3"); | 244 | = startupConfig.GetString("storage_connection_string", "URI=file:OpenSim.db,version=3"); |
243 | 245 | ||
244 | m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", ""); | 246 | m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", ""); |
@@ -268,7 +270,7 @@ namespace OpenSim | |||
268 | if (!m_sandbox) | 270 | if (!m_sandbox) |
269 | m_SendChildAgentTaskData = false; | 271 | m_SendChildAgentTaskData = false; |
270 | 272 | ||
271 | 273 | ||
272 | m_networkServersInfo.loadFromConfiguration(m_config); | 274 | m_networkServersInfo.loadFromConfiguration(m_config); |
273 | } | 275 | } |
274 | 276 | ||
@@ -327,16 +329,16 @@ namespace OpenSim | |||
327 | MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins"); | 329 | MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins"); |
328 | foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup")) | 330 | foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup")) |
329 | { | 331 | { |
330 | IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance(); | 332 | IApplicationPlugin plugin = (IApplicationPlugin) node.CreateInstance(); |
331 | plugin.Initialise(this); | 333 | plugin.Initialise(this); |
332 | m_plugins.Add(plugin); | 334 | m_plugins.Add(plugin); |
333 | } | 335 | } |
334 | 336 | ||
335 | // Start UDP servers | 337 | // Start UDP servers |
336 | //for (int i = 0; i < m_udpServers.Count; i++) | 338 | //for (int i = 0; i < m_udpServers.Count; i++) |
337 | //{ | 339 | //{ |
338 | // m_udpServers[i].ServerListener(); | 340 | // m_udpServers[i].ServerListener(); |
339 | // } | 341 | // } |
340 | 342 | ||
341 | //Run Startup Commands | 343 | //Run Startup Commands |
342 | if (m_startupCommandsFile != "") | 344 | if (m_startupCommandsFile != "") |
@@ -353,10 +355,10 @@ namespace OpenSim | |||
353 | 355 | ||
354 | if (m_timedScript != "disabled") | 356 | if (m_timedScript != "disabled") |
355 | { | 357 | { |
356 | m_scriptTimer = new System.Timers.Timer(); | 358 | m_scriptTimer = new Timer(); |
357 | m_scriptTimer.Enabled = true; | 359 | m_scriptTimer.Enabled = true; |
358 | m_scriptTimer.Interval = (int)(1200 * 1000); | 360 | m_scriptTimer.Interval = (int) (1200*1000); |
359 | m_scriptTimer.Elapsed += new System.Timers.ElapsedEventHandler(RunAutoTimerScript); | 361 | m_scriptTimer.Elapsed += new ElapsedEventHandler(RunAutoTimerScript); |
360 | } | 362 | } |
361 | } | 363 | } |
362 | 364 | ||
@@ -402,11 +404,13 @@ namespace OpenSim | |||
402 | SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); | 404 | SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); |
403 | if (m_SendChildAgentTaskData) | 405 | if (m_SendChildAgentTaskData) |
404 | { | 406 | { |
405 | MainLog.Instance.Error("WARNING", "Send Child Agent Task Updates is enabled. This is for testing only. It doesn't work on grid mode!"); | 407 | MainLog.Instance.Error("WARNING", |
406 | System.Threading.Thread.Sleep(12000); | 408 | "Send Child Agent Task Updates is enabled. This is for testing only. It doesn't work on grid mode!"); |
409 | Thread.Sleep(12000); | ||
407 | } | 410 | } |
408 | return | 411 | return |
409 | new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer, | 412 | new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, |
413 | storageManager, m_httpServer, | ||
410 | m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_SendChildAgentTaskData); | 414 | m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_SendChildAgentTaskData); |
411 | } | 415 | } |
412 | 416 | ||
@@ -440,16 +444,15 @@ namespace OpenSim | |||
440 | m_assetCache = new AssetCache(assetServer, m_log); | 444 | m_assetCache = new AssetCache(assetServer, m_log); |
441 | // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); | 445 | // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); |
442 | m_sceneManager.OnRestartSim += handleRestartRegion; | 446 | m_sceneManager.OnRestartSim += handleRestartRegion; |
443 | |||
444 | } | 447 | } |
445 | 448 | ||
446 | public void handleRestartRegion(RegionInfo whichRegion) | 449 | public void handleRestartRegion(RegionInfo whichRegion) |
447 | { | 450 | { |
448 | MainLog.Instance.Error("MAIN", "Got restart signal from SceneManager"); | 451 | MainLog.Instance.Error("MAIN", "Got restart signal from SceneManager"); |
449 | // Shutting down the UDP server | 452 | // Shutting down the UDP server |
450 | bool foundUDPServer = false; | 453 | bool foundUDPServer = false; |
451 | int UDPServerElement = 0; | 454 | int UDPServerElement = 0; |
452 | 455 | ||
453 | for (int i = 0; i < m_udpServers.Count; i++) | 456 | for (int i = 0; i < m_udpServers.Count; i++) |
454 | { | 457 | { |
455 | if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle) | 458 | if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle) |
@@ -459,9 +462,9 @@ namespace OpenSim | |||
459 | break; | 462 | break; |
460 | } | 463 | } |
461 | } | 464 | } |
462 | if (foundUDPServer) | 465 | if (foundUDPServer) |
463 | { | 466 | { |
464 | // m_udpServers[UDPServerElement].Server.End | 467 | // m_udpServers[UDPServerElement].Server.End |
465 | m_udpServers[UDPServerElement].Server.Close(); | 468 | m_udpServers[UDPServerElement].Server.Close(); |
466 | m_udpServers.RemoveAt(UDPServerElement); | 469 | m_udpServers.RemoveAt(UDPServerElement); |
467 | } | 470 | } |
@@ -479,7 +482,7 @@ namespace OpenSim | |||
479 | { | 482 | { |
480 | m_regionData.RemoveAt(RegionHandleElement); | 483 | m_regionData.RemoveAt(RegionHandleElement); |
481 | } | 484 | } |
482 | 485 | ||
483 | CreateRegion(whichRegion); | 486 | CreateRegion(whichRegion); |
484 | //UDPServer restartingRegion = CreateRegion(whichRegion); | 487 | //UDPServer restartingRegion = CreateRegion(whichRegion); |
485 | //restartingRegion.ServerListener(); | 488 | //restartingRegion.ServerListener(); |
@@ -537,7 +540,7 @@ namespace OpenSim | |||
537 | { | 540 | { |
538 | RunCommandScript(m_shutdownCommandsFile); | 541 | RunCommandScript(m_shutdownCommandsFile); |
539 | } | 542 | } |
540 | 543 | ||
541 | m_log.Verbose("SHUTDOWN", "Closing all threads"); | 544 | m_log.Verbose("SHUTDOWN", "Closing all threads"); |
542 | m_log.Verbose("SHUTDOWN", "Killing listener thread"); | 545 | m_log.Verbose("SHUTDOWN", "Killing listener thread"); |
543 | m_log.Verbose("SHUTDOWN", "Killing clients"); | 546 | m_log.Verbose("SHUTDOWN", "Killing clients"); |
@@ -557,6 +560,7 @@ namespace OpenSim | |||
557 | RunCommandScript(m_timedScript); | 560 | RunCommandScript(m_timedScript); |
558 | } | 561 | } |
559 | } | 562 | } |
563 | |||
560 | #region Console Commands | 564 | #region Console Commands |
561 | 565 | ||
562 | /// <summary> | 566 | /// <summary> |
@@ -679,10 +683,17 @@ namespace OpenSim | |||
679 | } | 683 | } |
680 | if (cmdparams.Length > 2) | 684 | if (cmdparams.Length > 2) |
681 | { | 685 | { |
682 | loadOffset.X = (float)Convert.ToDecimal(cmdparams[2]); | 686 | loadOffset.X = (float) Convert.ToDecimal(cmdparams[2]); |
683 | if (cmdparams.Length > 3) { loadOffset.Y = (float)Convert.ToDecimal(cmdparams[3]); } | 687 | if (cmdparams.Length > 3) |
684 | if (cmdparams.Length > 4) { loadOffset.Z = (float)Convert.ToDecimal(cmdparams[4]); } | 688 | { |
685 | m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + loadOffset.Z + ">"); | 689 | loadOffset.Y = (float) Convert.ToDecimal(cmdparams[3]); |
690 | } | ||
691 | if (cmdparams.Length > 4) | ||
692 | { | ||
693 | loadOffset.Z = (float) Convert.ToDecimal(cmdparams[4]); | ||
694 | } | ||
695 | m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + | ||
696 | loadOffset.Z + ">"); | ||
686 | } | 697 | } |
687 | } | 698 | } |
688 | m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); | 699 | m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); |
@@ -795,12 +806,13 @@ namespace OpenSim | |||
795 | 806 | ||
796 | if (m_sceneManager.CurrentScene == null) | 807 | if (m_sceneManager.CurrentScene == null) |
797 | { | 808 | { |
798 | MainLog.Instance.Verbose("CONSOLE", | 809 | MainLog.Instance.Verbose("CONSOLE", |
799 | "Currently at Root level. To change region please use 'change-region <regioname>'"); | 810 | "Currently at Root level. To change region please use 'change-region <regioname>'"); |
800 | } | 811 | } |
801 | else | 812 | else |
802 | { | 813 | { |
803 | MainLog.Instance.Verbose("CONSOLE", "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + | 814 | MainLog.Instance.Verbose("CONSOLE", |
815 | "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + | ||
804 | ". To change region please use 'change-region <regioname>'"); | 816 | ". To change region please use 'change-region <regioname>'"); |
805 | } | 817 | } |
806 | 818 | ||
@@ -901,10 +913,13 @@ namespace OpenSim | |||
901 | break; | 913 | break; |
902 | 914 | ||
903 | case "regions": | 915 | case "regions": |
904 | m_sceneManager.ForEachScene(delegate(Scene scene) | 916 | m_sceneManager.ForEachScene( |
905 | { | 917 | delegate(Scene scene) |
906 | m_log.Error("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + scene.RegionInfo.RegionLocX + " , Region YLoc: " + scene.RegionInfo.RegionLocY); | 918 | { |
907 | }); | 919 | m_log.Error("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + |
920 | scene.RegionInfo.RegionLocX + " , Region YLoc: " + | ||
921 | scene.RegionInfo.RegionLocY); | ||
922 | }); | ||
908 | break; | 923 | break; |
909 | } | 924 | } |
910 | } | 925 | } |
@@ -922,4 +937,4 @@ namespace OpenSim | |||
922 | 937 | ||
923 | #endregion | 938 | #endregion |
924 | } | 939 | } |
925 | } | 940 | } \ No newline at end of file |