diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSimMain.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 94 |
1 files changed, 55 insertions, 39 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index eaa067b..e2486bd 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -44,6 +44,7 @@ using OpenSim.Region.ClientStack; | |||
44 | using OpenSim.Region.Communications.Local; | 44 | using OpenSim.Region.Communications.Local; |
45 | using OpenSim.Region.Communications.OGS1; | 45 | using OpenSim.Region.Communications.OGS1; |
46 | using OpenSim.Region.Environment.Scenes; | 46 | using OpenSim.Region.Environment.Scenes; |
47 | using System.Text; | ||
47 | 48 | ||
48 | namespace OpenSim | 49 | namespace OpenSim |
49 | { | 50 | { |
@@ -51,7 +52,7 @@ namespace OpenSim | |||
51 | public class OpenSimMain : RegionApplicationBase, conscmd_callback | 52 | public class OpenSimMain : RegionApplicationBase, conscmd_callback |
52 | { | 53 | { |
53 | protected CommunicationsManager commsManager; | 54 | protected CommunicationsManager commsManager; |
54 | // private CheckSumServer checkServer; | 55 | // private CheckSumServer checkServer; |
55 | 56 | ||
56 | private bool m_silent; | 57 | private bool m_silent; |
57 | private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; | 58 | private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; |
@@ -84,10 +85,10 @@ namespace OpenSim | |||
84 | m_log = new LogBase(m_logFilename, "Region", this, m_silent); | 85 | m_log = new LogBase(m_logFilename, "Region", this, m_silent); |
85 | MainLog.Instance = m_log; | 86 | MainLog.Instance = m_log; |
86 | 87 | ||
87 | m_log.Verbose( "Main.cs:Startup() - Loading configuration"); | 88 | m_log.Verbose("Main.cs:Startup() - Loading configuration"); |
88 | this.serversData.InitConfig(this.m_sandbox, this.localConfig); | 89 | this.serversData.InitConfig(this.m_sandbox, this.localConfig); |
89 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | 90 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change |
90 | 91 | ||
91 | ScenePresence.LoadTextureFile("avatar-texture.dat"); | 92 | ScenePresence.LoadTextureFile("avatar-texture.dat"); |
92 | 93 | ||
93 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | 94 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); |
@@ -95,8 +96,8 @@ namespace OpenSim | |||
95 | if (m_sandbox) | 96 | if (m_sandbox) |
96 | { | 97 | { |
97 | this.SetupLocalGridServers(); | 98 | this.SetupLocalGridServers(); |
98 | // this.checkServer = new CheckSumServer(12036); | 99 | // this.checkServer = new CheckSumServer(12036); |
99 | // this.checkServer.ServerListener(); | 100 | // this.checkServer.ServerListener(); |
100 | this.commsManager = new CommunicationsLocal(this.serversData); | 101 | this.commsManager = new CommunicationsLocal(this.serversData); |
101 | } | 102 | } |
102 | else | 103 | else |
@@ -114,7 +115,7 @@ namespace OpenSim | |||
114 | 115 | ||
115 | this.SetupWorld(); | 116 | this.SetupWorld(); |
116 | 117 | ||
117 | m_log.Verbose( "Main.cs:Startup() - Initialising HTTP server"); | 118 | m_log.Verbose("Main.cs:Startup() - Initialising HTTP server"); |
118 | 119 | ||
119 | 120 | ||
120 | 121 | ||
@@ -124,7 +125,7 @@ namespace OpenSim | |||
124 | } | 125 | } |
125 | 126 | ||
126 | //Start http server | 127 | //Start http server |
127 | m_log.Verbose( "Main.cs:Startup() - Starting HTTP server"); | 128 | m_log.Verbose("Main.cs:Startup() - Starting HTTP server"); |
128 | httpServer.Start(); | 129 | httpServer.Start(); |
129 | 130 | ||
130 | // Start UDP servers | 131 | // Start UDP servers |
@@ -145,7 +146,7 @@ namespace OpenSim | |||
145 | } | 146 | } |
146 | catch (Exception e) | 147 | catch (Exception e) |
147 | { | 148 | { |
148 | m_log.Error( e.Message + "\nSorry, could not setup local cache"); | 149 | m_log.Error(e.Message + "\nSorry, could not setup local cache"); |
149 | Environment.Exit(1); | 150 | Environment.Exit(1); |
150 | } | 151 | } |
151 | 152 | ||
@@ -160,7 +161,7 @@ namespace OpenSim | |||
160 | } | 161 | } |
161 | catch (Exception e) | 162 | catch (Exception e) |
162 | { | 163 | { |
163 | m_log.Error( e.Message + "\nSorry, could not setup remote cache"); | 164 | m_log.Error(e.Message + "\nSorry, could not setup remote cache"); |
164 | Environment.Exit(1); | 165 | Environment.Exit(1); |
165 | } | 166 | } |
166 | } | 167 | } |
@@ -226,7 +227,7 @@ namespace OpenSim | |||
226 | LocalWorld.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. | 227 | LocalWorld.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. |
227 | LocalWorld.LoadWorldMap(); | 228 | LocalWorld.LoadWorldMap(); |
228 | 229 | ||
229 | m_log.Verbose( "Main.cs:Startup() - Starting up messaging system"); | 230 | m_log.Verbose("Main.cs:Startup() - Starting up messaging system"); |
230 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); | 231 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); |
231 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); | 232 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); |
232 | LocalWorld.LoadPrimsFromStorage(); | 233 | LocalWorld.LoadPrimsFromStorage(); |
@@ -244,21 +245,36 @@ namespace OpenSim | |||
244 | } | 245 | } |
245 | } | 246 | } |
246 | 247 | ||
247 | protected override void SetupHttpListener() | 248 | private class SimStatusHandler : IStreamHandler |
248 | { | 249 | { |
249 | httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); | 250 | public byte[] Handle(string path, Stream request) |
251 | { | ||
252 | return Encoding.UTF8.GetBytes("OK"); | ||
253 | } | ||
250 | 254 | ||
251 | if (!this.m_sandbox) | 255 | public string ContentType |
252 | { | 256 | { |
257 | get { return "text/plain"; } | ||
258 | } | ||
253 | 259 | ||
254 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server | 260 | public string HttpMethod |
261 | { | ||
262 | get { return "GET"; } | ||
263 | } | ||
264 | |||
265 | public string Path | ||
266 | { | ||
267 | get { return "/simstatus/"; } | ||
268 | } | ||
269 | } | ||
255 | 270 | ||
271 | protected override void SetupHttpListener() | ||
272 | { | ||
273 | httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); | ||
256 | 274 | ||
257 | httpServer.AddRestHandler("GET", "/simstatus/", | 275 | if (!this.m_sandbox) |
258 | delegate(string request, string path, string param) | 276 | { |
259 | { | 277 | httpServer.AddStreamHandler( new SimStatusHandler() ); |
260 | return "OK"; | ||
261 | }); | ||
262 | } | 278 | } |
263 | } | 279 | } |
264 | 280 | ||
@@ -340,7 +356,7 @@ namespace OpenSim | |||
340 | switch (attri) | 356 | switch (attri) |
341 | { | 357 | { |
342 | default: | 358 | default: |
343 | m_log.Warn( "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); | 359 | m_log.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); |
344 | Environment.Exit(1); | 360 | Environment.Exit(1); |
345 | break; | 361 | break; |
346 | 362 | ||
@@ -376,11 +392,11 @@ namespace OpenSim | |||
376 | /// </summary> | 392 | /// </summary> |
377 | public virtual void Shutdown() | 393 | public virtual void Shutdown() |
378 | { | 394 | { |
379 | m_log.Verbose( "Main.cs:Shutdown() - Closing all threads"); | 395 | m_log.Verbose("Main.cs:Shutdown() - Closing all threads"); |
380 | m_log.Verbose( "Main.cs:Shutdown() - Killing listener thread"); | 396 | m_log.Verbose("Main.cs:Shutdown() - Killing listener thread"); |
381 | m_log.Verbose( "Main.cs:Shutdown() - Killing clients"); | 397 | m_log.Verbose("Main.cs:Shutdown() - Killing clients"); |
382 | // IMPLEMENT THIS | 398 | // IMPLEMENT THIS |
383 | m_log.Verbose( "Main.cs:Shutdown() - Closing console and terminating"); | 399 | m_log.Verbose("Main.cs:Shutdown() - Closing console and terminating"); |
384 | for (int i = 0; i < m_localWorld.Count; i++) | 400 | for (int i = 0; i < m_localWorld.Count; i++) |
385 | { | 401 | { |
386 | ((Scene)m_localWorld[i]).Close(); | 402 | ((Scene)m_localWorld[i]).Close(); |
@@ -400,8 +416,8 @@ namespace OpenSim | |||
400 | switch (command) | 416 | switch (command) |
401 | { | 417 | { |
402 | case "help": | 418 | case "help": |
403 | m_log.Error( "show users - show info about connected users"); | 419 | m_log.Error("show users - show info about connected users"); |
404 | m_log.Error( "shutdown - disconnect all clients and shutdown"); | 420 | m_log.Error("shutdown - disconnect all clients and shutdown"); |
405 | break; | 421 | break; |
406 | 422 | ||
407 | case "show": | 423 | case "show": |
@@ -415,7 +431,7 @@ namespace OpenSim | |||
415 | string result = ""; | 431 | string result = ""; |
416 | for (int i = 0; i < m_localWorld.Count; i++) | 432 | for (int i = 0; i < m_localWorld.Count; i++) |
417 | { | 433 | { |
418 | if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result,m_localWorld[i].RegionInfo.RegionName)) | 434 | if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result, m_localWorld[i].RegionInfo.RegionName)) |
419 | { | 435 | { |
420 | m_log.Error(result); | 436 | m_log.Error(result); |
421 | } | 437 | } |
@@ -427,7 +443,7 @@ namespace OpenSim | |||
427 | break; | 443 | break; |
428 | 444 | ||
429 | default: | 445 | default: |
430 | m_log.Error( "Unknown command"); | 446 | m_log.Error("Unknown command"); |
431 | break; | 447 | break; |
432 | } | 448 | } |
433 | } | 449 | } |
@@ -441,22 +457,22 @@ namespace OpenSim | |||
441 | switch (ShowWhat) | 457 | switch (ShowWhat) |
442 | { | 458 | { |
443 | case "uptime": | 459 | case "uptime": |
444 | m_log.Error( "OpenSim has been running since " + startuptime.ToString()); | 460 | m_log.Error("OpenSim has been running since " + startuptime.ToString()); |
445 | m_log.Error( "That is " + (DateTime.Now - startuptime).ToString()); | 461 | m_log.Error("That is " + (DateTime.Now - startuptime).ToString()); |
446 | break; | 462 | break; |
447 | case "users": | 463 | case "users": |
448 | ScenePresence TempAv; | 464 | ScenePresence TempAv; |
449 | 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")); | 465 | 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")); |
450 | for (int i = 0; i < m_localWorld.Count; i++) | 466 | for (int i = 0; i < m_localWorld.Count; i++) |
451 | { | 467 | { |
452 | foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) | 468 | foreach (libsecondlife.LLUUID UUID in ((Scene)m_localWorld[i]).Entities.Keys) |
453 | { | 469 | { |
454 | if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") | 470 | if (((Scene)m_localWorld[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") |
455 | { | 471 | { |
456 | TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; | 472 | TempAv = (ScenePresence)((Scene)m_localWorld[i]).Entities[UUID]; |
457 | m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); | 473 | m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localWorld[i]).RegionInfo.RegionName); |
458 | } | 474 | } |
459 | } | 475 | } |
460 | } | 476 | } |
461 | break; | 477 | break; |
462 | } | 478 | } |