diff options
author | lbsa71 | 2007-03-28 05:27:20 +0000 |
---|---|---|
committer | lbsa71 | 2007-03-28 05:27:20 +0000 |
commit | d66ef8f428b763fca3610869c85adb55aef5d9e5 (patch) | |
tree | d3b15df4b9e31b9c186fa7ea560be283c94d4799 /OpenSim.RegionServer/OpenSimMain.cs | |
parent | Who dropped my child_agent flag? It returns (diff) | |
download | opensim-SC_OLD-d66ef8f428b763fca3610869c85adb55aef5d9e5.zip opensim-SC_OLD-d66ef8f428b763fca3610869c85adb55aef5d9e5.tar.gz opensim-SC_OLD-d66ef8f428b763fca3610869c85adb55aef5d9e5.tar.bz2 opensim-SC_OLD-d66ef8f428b763fca3610869c85adb55aef5d9e5.tar.xz |
* worked a little bit more on straigthening the startup procedure out
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 78 |
1 files changed, 53 insertions, 25 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index d6453e2..497b801 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -63,42 +63,64 @@ namespace OpenSim | |||
63 | 63 | ||
64 | private System.Timers.Timer timer1 = new System.Timers.Timer(); | 64 | private System.Timers.Timer timer1 = new System.Timers.Timer(); |
65 | private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll"; | 65 | private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll"; |
66 | public string _physicsEngine = "basicphysics"; | 66 | public string m_physicsEngine; |
67 | public bool sandbox = false; | 67 | public bool m_sandbox = false; |
68 | public bool loginserver = false; | 68 | public bool m_loginserver; |
69 | 69 | ||
70 | protected ConsoleBase m_console; | 70 | protected ConsoleBase m_console; |
71 | 71 | ||
72 | public OpenSimMain() | 72 | public OpenSimMain( bool sandBoxMode, bool startLoginServer, string physicsEngine ) |
73 | { | 73 | { |
74 | m_sandbox = sandBoxMode; | ||
75 | m_loginserver = startLoginServer; | ||
76 | m_physicsEngine = physicsEngine; | ||
77 | |||
74 | m_console = new ConsoleBase("region-console.log", "Region", this); | 78 | m_console = new ConsoleBase("region-console.log", "Region", this); |
75 | OpenSim.Framework.Console.MainConsole.Instance = m_console; | 79 | OpenSim.Framework.Console.MainConsole.Instance = m_console; |
76 | } | 80 | } |
77 | 81 | ||
78 | public override void StartUp() | 82 | public override void StartUp() |
79 | { | 83 | { |
84 | OpenSimRoot.Instance.GridServers = new Grid(); | ||
85 | if ( m_sandbox ) | ||
86 | { | ||
87 | OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
88 | OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; | ||
89 | |||
90 | m_console.WriteLine("Starting in Sandbox mode"); | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
95 | OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
96 | |||
97 | m_console.WriteLine("Starting in Grid mode"); | ||
98 | } | ||
99 | |||
100 | OpenSimRoot.Instance.GridServers.Initialise(); | ||
101 | |||
80 | OpenSimRoot.Instance.startuptime = DateTime.Now; | 102 | OpenSimRoot.Instance.startuptime = DateTime.Now; |
81 | 103 | ||
82 | OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer); | 104 | OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer); |
83 | OpenSimRoot.Instance.InventoryCache = new InventoryCache(); | 105 | OpenSimRoot.Instance.InventoryCache = new InventoryCache(); |
84 | 106 | ||
85 | // We check our local database first, then the grid for config options | 107 | // We check our local database first, then the grid for config options |
86 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); | 108 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); |
87 | OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll); | 109 | OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll); |
88 | OpenSimRoot.Instance.Cfg.InitConfig(this.sandbox); | 110 | OpenSimRoot.Instance.Cfg.InitConfig(this.m_sandbox); |
89 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver"); | 111 | m_console.WriteLine("Main.cs:Startup() - Contacting gridserver"); |
90 | OpenSimRoot.Instance.Cfg.LoadFromGrid(); | 112 | OpenSimRoot.Instance.Cfg.LoadFromGrid(); |
91 | 113 | ||
92 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString()); | 114 | m_console.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString()); |
93 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world"); | 115 | m_console.WriteLine("Initialising world"); |
94 | OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg); | 116 | OpenSimRoot.Instance.LocalWorld = new World(OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.Cfg.RegionHandle, OpenSimRoot.Instance.Cfg.RegionName, OpenSimRoot.Instance.Cfg); |
95 | OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld(); | 117 | OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld(); |
96 | 118 | ||
97 | this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); | 119 | this.physManager = new OpenSim.Physics.Manager.PhysicsManager(); |
98 | this.physManager.LoadPlugins(); | 120 | this.physManager.LoadPlugins(); |
99 | 121 | ||
100 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); | 122 | m_console.WriteLine("Main.cs:Startup() - Starting up messaging system"); |
101 | OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use | 123 | OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use |
102 | OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap); | 124 | OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap); |
103 | 125 | ||
104 | OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey); | 126 | OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey); |
@@ -107,20 +129,26 @@ namespace OpenSim | |||
107 | OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. | 129 | OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. |
108 | OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage(); | 130 | OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage(); |
109 | 131 | ||
110 | if (this.sandbox) | 132 | if ( m_sandbox) |
111 | { | 133 | { |
112 | OpenSimRoot.Instance.AssetCache.LoadDefaultTextureSet(); | 134 | OpenSimRoot.Instance.AssetCache.LoadDefaultTextureSet(); |
113 | } | 135 | } |
114 | 136 | ||
115 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); | 137 | m_console.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); |
116 | OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort); | 138 | OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort); |
117 | OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld)); | 139 | OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", OpenSimRoot.Instance.LocalWorld)); |
118 | 140 | ||
141 | if ( m_loginserver && m_sandbox) | ||
142 | { | ||
143 | LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenAddr, OpenSimRoot.Instance.Cfg.IPListenPort); | ||
144 | loginServer.Startup(); | ||
145 | } | ||
146 | |||
147 | MainServerListener(); | ||
148 | |||
119 | timer1.Enabled = true; | 149 | timer1.Enabled = true; |
120 | timer1.Interval = 100; | 150 | timer1.Interval = 100; |
121 | timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick); | 151 | timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick); |
122 | |||
123 | MainServerListener(); | ||
124 | } | 152 | } |
125 | 153 | ||
126 | private SimConfig LoadConfigDll(string dllName) | 154 | private SimConfig LoadConfigDll(string dllName) |
@@ -185,21 +213,21 @@ namespace OpenSim | |||
185 | 213 | ||
186 | private void MainServerListener() | 214 | private void MainServerListener() |
187 | { | 215 | { |
188 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started"); | 216 | m_console.WriteLine("Main.cs:MainServerListener() - New thread started"); |
189 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + OpenSimRoot.Instance.Cfg.IPListenAddr + ":" + OpenSimRoot.Instance.Cfg.IPListenPort); | 217 | m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + OpenSimRoot.Instance.Cfg.IPListenAddr + ":" + OpenSimRoot.Instance.Cfg.IPListenPort); |
190 | 218 | ||
191 | ServerIncoming = new IPEndPoint(IPAddress.Any, OpenSimRoot.Instance.Cfg.IPListenPort); | 219 | ServerIncoming = new IPEndPoint(IPAddress.Any, OpenSimRoot.Instance.Cfg.IPListenPort); |
192 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | 220 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
193 | Server.Bind(ServerIncoming); | 221 | Server.Bind(ServerIncoming); |
194 | 222 | ||
195 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); | 223 | m_console.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); |
196 | 224 | ||
197 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | 225 | ipeSender = new IPEndPoint(IPAddress.Any, 0); |
198 | epSender = (EndPoint)ipeSender; | 226 | epSender = (EndPoint)ipeSender; |
199 | ReceivedData = new AsyncCallback(this.OnReceivedData); | 227 | ReceivedData = new AsyncCallback(this.OnReceivedData); |
200 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 228 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
201 | 229 | ||
202 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening..."); | 230 | m_console.WriteLine("Main.cs:MainServerListener() - Listening..."); |
203 | 231 | ||
204 | } | 232 | } |
205 | 233 | ||
@@ -236,14 +264,14 @@ namespace OpenSim | |||
236 | 264 | ||
237 | public override void Shutdown() | 265 | public override void Shutdown() |
238 | { | 266 | { |
239 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads"); | 267 | m_console.WriteLine("Main.cs:Shutdown() - Closing all threads"); |
240 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread"); | 268 | m_console.WriteLine("Main.cs:Shutdown() - Killing listener thread"); |
241 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients"); | 269 | m_console.WriteLine("Main.cs:Shutdown() - Killing clients"); |
242 | // IMPLEMENT THIS | 270 | // IMPLEMENT THIS |
243 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); | 271 | m_console.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); |
244 | OpenSimRoot.Instance.LocalWorld.Close(); | 272 | OpenSimRoot.Instance.LocalWorld.Close(); |
245 | OpenSimRoot.Instance.GridServers.Close(); | 273 | OpenSimRoot.Instance.GridServers.Close(); |
246 | OpenSim.Framework.Console.MainConsole.Instance.Close(); | 274 | m_console.Close(); |
247 | Environment.Exit(0); | 275 | Environment.Exit(0); |
248 | } | 276 | } |
249 | 277 | ||
@@ -271,7 +299,7 @@ namespace OpenSim | |||
271 | break; | 299 | break; |
272 | 300 | ||
273 | case "shutdown": | 301 | case "shutdown": |
274 | OpenSimRoot.Instance.Shutdown(); | 302 | Shutdown(); |
275 | break; | 303 | break; |
276 | } | 304 | } |
277 | } | 305 | } |