aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/Application.cs17
-rw-r--r--OpenSim/Region/Application/OpenSimController.cs68
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs68
-rw-r--r--OpenSim/Region/Application/VersionInfo.cs2
4 files changed, 71 insertions, 84 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 0288f63..bb26ce3 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -26,27 +26,24 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Scenes;
31using Nini.Config; 29using Nini.Config;
32using System.Threading;
33using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Console;
34 32
35namespace OpenSim 33namespace OpenSim
36{ 34{
37 public class Application 35 public class Application
38 { 36 {
39 //could move our main function into OpenSimMain and kill this class 37 //could move our main function into OpenSimMain and kill this class
40 [STAThread] 38 [STAThread]
41 public static void Main(string[] args) 39 public static void Main(string[] args)
42 { 40 {
43
44 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); 41 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
45 42
46 43
47 Console.Write("Performing compatibility checks... "); 44 Console.Write("Performing compatibility checks... ");
48 string supported = ""; 45 string supported = "";
49 if (OpenSim.Framework.Util.IsEnvironmentSupported(ref supported)) 46 if (Util.IsEnvironmentSupported(ref supported))
50 { 47 {
51 Console.WriteLine(" Environment is compatible.\n"); 48 Console.WriteLine(" Environment is compatible.\n");
52 } 49 }
@@ -54,10 +51,10 @@ namespace OpenSim
54 { 51 {
55 Console.WriteLine(" Environment is unsupported (" + supported + ")\n"); 52 Console.WriteLine(" Environment is unsupported (" + supported + ")\n");
56 } 53 }
57 54
58 Console.WriteLine("Starting...\n"); 55 Console.WriteLine("Starting...\n");
59 56
60 Culture.SetCurrentCulture(); 57 Culture.SetCurrentCulture();
61 58
62 ArgvConfigSource configSource = new ArgvConfigSource(args); 59 ArgvConfigSource configSource = new ArgvConfigSource(args);
63 60
@@ -80,4 +77,4 @@ namespace OpenSim
80 } 77 }
81 } 78 }
82 } 79 }
83} 80} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimController.cs b/OpenSim/Region/Application/OpenSimController.cs
index da93b54..1fa4b04 100644
--- a/OpenSim/Region/Application/OpenSimController.cs
+++ b/OpenSim/Region/Application/OpenSimController.cs
@@ -1,28 +1,15 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Collections; 2using System.Collections;
4using System.IO; 3using System.Net;
5using System.Text; 4using System.Timers;
6using Nini.Config; 5using Nwc.XmlRpc;
7using OpenSim.Framework.Communications.Cache; 6using OpenSim.Framework;
8using OpenSim.Framework.Console; 7using OpenSim.Framework.Console;
9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Servers; 8using OpenSim.Framework.Servers;
11using OpenSim.Framework;
12using OpenSim.Framework;
13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.Communications.OGS1;
16using OpenSim.Region.Environment;
17using OpenSim.Region.Environment.Scenes;
18using OpenSim.Region.Physics.Manager;
19using System.Globalization;
20using Nwc.XmlRpc;
21using RegionInfo = OpenSim.Framework.RegionInfo;
22 9
23namespace OpenSim 10namespace OpenSim
24{ 11{
25 class OpenSimController 12 internal class OpenSimController
26 { 13 {
27 private OpenSimMain m_app; 14 private OpenSimMain m_app;
28 private BaseHttpServer m_httpServer; 15 private BaseHttpServer m_httpServer;
@@ -44,22 +31,23 @@ namespace OpenSim
44 { 31 {
45 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); 32 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request");
46 XmlRpcResponse response = new XmlRpcResponse(); 33 XmlRpcResponse response = new XmlRpcResponse();
47 Hashtable requestData = (Hashtable)request.Params[0]; 34 Hashtable requestData = (Hashtable) request.Params[0];
48 35
49 if ((string)requestData["shutdown"] == "delayed") 36 if ((string) requestData["shutdown"] == "delayed")
50 { 37 {
51 int timeout = Convert.ToInt32((string)requestData["milliseconds"]); 38 int timeout = Convert.ToInt32((string) requestData["milliseconds"]);
52 39
53 Hashtable responseData = new Hashtable(); 40 Hashtable responseData = new Hashtable();
54 responseData["accepted"] = "true"; 41 responseData["accepted"] = "true";
55 response.Value = responseData; 42 response.Value = responseData;
56 43
57 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out."); 44 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
45 " second(s). Please save what you are doing and log out.");
58 46
59 // Perform shutdown 47 // Perform shutdown
60 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing 48 Timer shutdownTimer = new Timer(timeout); // Wait before firing
61 shutdownTimer.AutoReset = false; 49 shutdownTimer.AutoReset = false;
62 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 50 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
63 51
64 return response; 52 return response;
65 } 53 }
@@ -72,15 +60,15 @@ namespace OpenSim
72 m_app.SceneManager.SendGeneralMessage("Region is going down now."); 60 m_app.SceneManager.SendGeneralMessage("Region is going down now.");
73 61
74 // Perform shutdown 62 // Perform shutdown
75 System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing 63 Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
76 shutdownTimer.AutoReset = false; 64 shutdownTimer.AutoReset = false;
77 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 65 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
78 66
79 return response; 67 return response;
80 } 68 }
81 } 69 }
82 70
83 void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 71 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
84 { 72 {
85 m_app.Shutdown(); 73 m_app.Shutdown();
86 } 74 }
@@ -89,28 +77,28 @@ namespace OpenSim
89 { 77 {
90 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); 78 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request");
91 XmlRpcResponse response = new XmlRpcResponse(); 79 XmlRpcResponse response = new XmlRpcResponse();
92 Hashtable requestData = (Hashtable)request.Params[0]; 80 Hashtable requestData = (Hashtable) request.Params[0];
93 81
94 RegionInfo newRegionData = new RegionInfo(); 82 RegionInfo newRegionData = new RegionInfo();
95 83
96 try 84 try
97 { 85 {
98 newRegionData.RegionID = (string)requestData["region_id"]; 86 newRegionData.RegionID = (string) requestData["region_id"];
99 newRegionData.RegionName = (string)requestData["region_name"]; 87 newRegionData.RegionName = (string) requestData["region_name"];
100 newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]); 88 newRegionData.RegionLocX = Convert.ToUInt32((string) requestData["region_x"]);
101 newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]); 89 newRegionData.RegionLocY = Convert.ToUInt32((string) requestData["region_y"]);
102 90
103 // Security risk 91 // Security risk
104 newRegionData.DataStore = (string)requestData["datastore"]; 92 newRegionData.DataStore = (string) requestData["datastore"];
105 93
106 newRegionData.InternalEndPoint = new System.Net.IPEndPoint( 94 newRegionData.InternalEndPoint = new IPEndPoint(
107 System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0); 95 IPAddress.Parse((string) requestData["listen_ip"]), 0);
108 96
109 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]); 97 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string) requestData["listen_port"]);
110 newRegionData.ExternalHostName = (string)requestData["external_address"]; 98 newRegionData.ExternalHostName = (string) requestData["external_address"];
111 99
112 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; 100 newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"];
113 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; 101 newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"];
114 102
115 m_app.CreateRegion(newRegionData); 103 m_app.CreateRegion(newRegionData);
116 104
@@ -129,4 +117,4 @@ namespace OpenSim
129 return response; 117 return response;
130 } 118 }
131 } 119 }
132} 120} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index b938227..7245482 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -31,21 +31,17 @@ using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Text; 32using System.Text;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework;
39using OpenSim.Framework;
40using OpenSim.Region.ClientStack; 38using OpenSim.Region.ClientStack;
41using OpenSim.Region.Communications.Local; 39using OpenSim.Region.Communications.Local;
42using OpenSim.Region.Communications.OGS1; 40using OpenSim.Region.Communications.OGS1;
43using OpenSim.Region.Environment; 41using OpenSim.Region.Environment;
42using OpenSim.Region.Environment.Interfaces;
44using OpenSim.Region.Environment.Scenes; 43using OpenSim.Region.Environment.Scenes;
45using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.Physics.Manager;
46using OpenSim.Framework;
47using System.Globalization;
48using RegionInfo = OpenSim.Framework.RegionInfo;
49 45
50namespace OpenSim 46namespace OpenSim
51{ 47{
@@ -114,7 +110,6 @@ namespace OpenSim
114 } 110 }
115 else 111 else
116 { 112 {
117
118 // no default config files, so set default values, and save it 113 // no default config files, so set default values, and save it
119 SetDefaultConfig(); 114 SetDefaultConfig();
120 115
@@ -125,7 +120,6 @@ namespace OpenSim
125 } 120 }
126 121
127 ReadConfigSettings(); 122 ReadConfigSettings();
128
129 } 123 }
130 124
131 protected void SetDefaultConfig() 125 protected void SetDefaultConfig()
@@ -148,7 +142,6 @@ namespace OpenSim
148 config.Set("script_engine", "DotNetEngine"); 142 config.Set("script_engine", "DotNetEngine");
149 143
150 config.Set("asset_database", "sqlite"); 144 config.Set("asset_database", "sqlite");
151
152 } 145 }
153 146
154 if (m_config.Configs["StandAlone"] == null) 147 if (m_config.Configs["StandAlone"] == null)
@@ -217,7 +210,8 @@ namespace OpenSim
217 standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); 210 standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
218 m_standaloneUserPlugin = 211 m_standaloneUserPlugin =
219 standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll"); 212 standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
220 m_standaloneAssetPlugin = standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll"); 213 m_standaloneAssetPlugin =
214 standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
221 215
222 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); 216 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
223 } 217 }
@@ -230,7 +224,6 @@ namespace OpenSim
230 /// </summary> 224 /// </summary>
231 public override void StartUp() 225 public override void StartUp()
232 { 226 {
233
234 if (!Directory.Exists(Util.logDir())) 227 if (!Directory.Exists(Util.logDir()))
235 { 228 {
236 Directory.CreateDirectory(Util.logDir()); 229 Directory.CreateDirectory(Util.logDir());
@@ -248,22 +241,28 @@ namespace OpenSim
248 LocalInventoryService inventoryService = new LocalInventoryService(); 241 LocalInventoryService inventoryService = new LocalInventoryService();
249 inventoryService.AddPlugin(m_standaloneInventoryPlugin); 242 inventoryService.AddPlugin(m_standaloneInventoryPlugin);
250 243
251 LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); 244 LocalUserServices userService =
245 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
246 m_networkServersInfo.DefaultHomeLocY, inventoryService);
252 userService.AddPlugin(m_standaloneUserPlugin); 247 userService.AddPlugin(m_standaloneUserPlugin);
253 248
254 LocalBackEndServices backendService = new LocalBackEndServices(); 249 LocalBackEndServices backendService = new LocalBackEndServices();
255 250
256 CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, m_dumpAssetsToFile); 251 CommunicationsLocal localComms =
252 new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService,
253 inventoryService, backendService, backendService, m_dumpAssetsToFile);
257 m_commsManager = localComms; 254 m_commsManager = localComms;
258 255
259 m_loginService = new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo, m_standaloneAuthenticate); 256 m_loginService =
257 new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo,
258 m_standaloneAuthenticate);
260 m_loginService.OnLoginToRegion += backendService.AddNewSession; 259 m_loginService.OnLoginToRegion += backendService.AddNewSession;
261 260
262 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); 261 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
263 262
264 if (m_standaloneAuthenticate) 263 if (m_standaloneAuthenticate)
265 { 264 {
266 this.CreateAccount = localComms.doCreate; 265 CreateAccount = localComms.doCreate;
267 } 266 }
268 } 267 }
269 else 268 else
@@ -308,7 +307,7 @@ namespace OpenSim
308 // Start UDP servers 307 // Start UDP servers
309 for (int i = 0; i < m_udpServers.Count; i++) 308 for (int i = 0; i < m_udpServers.Count; i++)
310 { 309 {
311 this.m_udpServers[i].ServerListener(); 310 m_udpServers[i].ServerListener();
312 } 311 }
313 312
314 //Run Startup Commands 313 //Run Startup Commands
@@ -321,7 +320,8 @@ namespace OpenSim
321 MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on..."); 320 MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on...");
322 } 321 }
323 322
324 MainLog.Instance.Status("STARTUP", "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); 323 MainLog.Instance.Status("STARTUP",
324 "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
325 } 325 }
326 326
327 public UDPServer CreateRegion(RegionInfo regionInfo) 327 public UDPServer CreateRegion(RegionInfo regionInfo)
@@ -365,9 +365,12 @@ namespace OpenSim
365 return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName); 365 return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName);
366 } 366 }
367 367
368 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) 368 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
369 AgentCircuitManager circuitManager)
369 { 370 {
370 return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, m_moduleLoader, m_dumpAssetsToFile); 371 return
372 new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer,
373 m_moduleLoader, m_dumpAssetsToFile);
371 } 374 }
372 375
373 protected override void Initialize() 376 protected override void Initialize()
@@ -436,7 +439,6 @@ namespace OpenSim
436 439
437 protected void ConnectToRemoteGridServer() 440 protected void ConnectToRemoteGridServer()
438 { 441 {
439
440 } 442 }
441 443
442 #endregion 444 #endregion
@@ -464,6 +466,7 @@ namespace OpenSim
464 } 466 }
465 467
466 #region Console Commands 468 #region Console Commands
469
467 /// <summary> 470 /// <summary>
468 /// 471 ///
469 /// </summary> 472 /// </summary>
@@ -649,11 +652,10 @@ namespace OpenSim
649 case "change-region": 652 case "change-region":
650 if (cmdparams.Length > 0) 653 if (cmdparams.Length > 0)
651 { 654 {
652 string regionName = this.CombineParams(cmdparams, 0); 655 string regionName = CombineParams(cmdparams, 0);
653 656
654 if (m_sceneManager.TrySetCurrentScene(regionName)) 657 if (m_sceneManager.TrySetCurrentScene(regionName))
655 { 658 {
656
657 } 659 }
658 else 660 else
659 { 661 {
@@ -663,11 +665,13 @@ namespace OpenSim
663 665
664 if (m_sceneManager.CurrentScene == null) 666 if (m_sceneManager.CurrentScene == null)
665 { 667 {
666 MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); 668 MainLog.Instance.Verbose(
669 "Currently at Root level. To change region please use 'change-region <regioname>'");
667 } 670 }
668 else 671 else
669 { 672 {
670 MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); 673 MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName +
674 ". To change region please use 'change-region <regioname>'");
671 } 675 }
672 676
673 break; 677 break;
@@ -676,7 +680,6 @@ namespace OpenSim
676 m_log.Error("Unknown command"); 680 m_log.Error("Unknown command");
677 break; 681 break;
678 } 682 }
679
680 } 683 }
681 684
682 public void Debug(string[] args) 685 public void Debug(string[] args)
@@ -695,8 +698,7 @@ namespace OpenSim
695 { 698 {
696 m_log.Error("packet debug should be 0..2"); 699 m_log.Error("packet debug should be 0..2");
697 } 700 }
698 System.Console.WriteLine("New packet debug: " + newDebug.ToString()); 701 Console.WriteLine("New packet debug: " + newDebug.ToString());
699
700 } 702 }
701 703
702 break; 704 break;
@@ -704,7 +706,6 @@ namespace OpenSim
704 m_log.Error("Unknown debug"); 706 m_log.Error("Unknown debug");
705 break; 707 break;
706 } 708 }
707
708 } 709 }
709 710
710 /// <summary> 711 /// <summary>
@@ -720,7 +721,9 @@ namespace OpenSim
720 m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); 721 m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString());
721 break; 722 break;
722 case "users": 723 case "users":
723 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); 724 m_log.Error(
725 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
726 "Agent ID", "Session ID", "Circuit", "IP", "World"));
724 727
725 foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars()) 728 foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars())
726 { 729 {
@@ -750,7 +753,7 @@ namespace OpenSim
750 break; 753 break;
751 case "modules": 754 case "modules":
752 m_log.Error("The currently loaded shared modules are:"); 755 m_log.Error("The currently loaded shared modules are:");
753 foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.GetLoadedSharedModules ) 756 foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
754 { 757 {
755 m_log.Error("Shared Module: " + module.Name); 758 m_log.Error("Shared Module: " + module.Name);
756 } 759 }
@@ -768,8 +771,7 @@ namespace OpenSim
768 result = result.TrimEnd(' '); 771 result = result.TrimEnd(' ');
769 return result; 772 return result;
770 } 773 }
774
771 #endregion 775 #endregion
772 } 776 }
773 777} \ No newline at end of file
774
775}
diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs
index f045164..7840206 100644
--- a/OpenSim/Region/Application/VersionInfo.cs
+++ b/OpenSim/Region/Application/VersionInfo.cs
@@ -33,4 +33,4 @@ namespace OpenSim
33 { 33 {
34 public static string Version = "0.4, SVN build "; 34 public static string Version = "0.4, SVN build ";
35 } 35 }
36} 36} \ No newline at end of file