aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs138
1 files changed, 74 insertions, 64 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index fb1e831..f418d7b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics;
31using System.IO; 32using System.IO;
32using System.Reflection; 33using System.Reflection;
33using System.Text; 34using System.Text;
@@ -69,6 +70,7 @@ namespace OpenSim
69 private Regex m_consolePromptRegex = new Regex(@"([^\\])\\(\w)", RegexOptions.Compiled); 70 private Regex m_consolePromptRegex = new Regex(@"([^\\])\\(\w)", RegexOptions.Compiled);
70 71
71 private string m_timedScript = "disabled"; 72 private string m_timedScript = "disabled";
73 private int m_timeInterval = 1200;
72 private Timer m_scriptTimer; 74 private Timer m_scriptTimer;
73 75
74 public OpenSim(IConfigSource configSource) : base(configSource) 76 public OpenSim(IConfigSource configSource) : base(configSource)
@@ -98,6 +100,10 @@ namespace OpenSim
98 m_consolePort = (uint)networkConfig.GetInt("console_port", 0); 100 m_consolePort = (uint)networkConfig.GetInt("console_port", 0);
99 101
100 m_timedScript = startupConfig.GetString("timer_Script", "disabled"); 102 m_timedScript = startupConfig.GetString("timer_Script", "disabled");
103 if (m_timedScript != "disabled")
104 {
105 m_timeInterval = startupConfig.GetInt("timer_Interval", 1200);
106 }
101 107
102 if (m_logFileAppender != null) 108 if (m_logFileAppender != null)
103 { 109 {
@@ -138,7 +144,7 @@ namespace OpenSim
138 m_log.Info("===================================================================="); 144 m_log.Info("====================================================================");
139 m_log.Info("========================= STARTING OPENSIM ========================="); 145 m_log.Info("========================= STARTING OPENSIM =========================");
140 m_log.Info("===================================================================="); 146 m_log.Info("====================================================================");
141 147
142 //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); 148 //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
143 // http://msdn.microsoft.com/en-us/library/bb384202.aspx 149 // http://msdn.microsoft.com/en-us/library/bb384202.aspx
144 //GCSettings.LatencyMode = GCLatencyMode.Batch; 150 //GCSettings.LatencyMode = GCLatencyMode.Batch;
@@ -215,7 +221,7 @@ namespace OpenSim
215 { 221 {
216 m_scriptTimer = new Timer(); 222 m_scriptTimer = new Timer();
217 m_scriptTimer.Enabled = true; 223 m_scriptTimer.Enabled = true;
218 m_scriptTimer.Interval = 1200*1000; 224 m_scriptTimer.Interval = m_timeInterval*1000;
219 m_scriptTimer.Elapsed += RunAutoTimerScript; 225 m_scriptTimer.Elapsed += RunAutoTimerScript;
220 } 226 }
221 } 227 }
@@ -225,7 +231,9 @@ namespace OpenSim
225 /// </summary> 231 /// </summary>
226 private void RegisterConsoleCommands() 232 private void RegisterConsoleCommands()
227 { 233 {
228 m_console.Commands.AddCommand("Regions", false, "force update", 234 MainServer.RegisterHttpConsoleCommands(m_console);
235
236 m_console.Commands.AddCommand("Objects", false, "force update",
229 "force update", 237 "force update",
230 "Force the update of all objects on clients", 238 "Force the update of all objects on clients",
231 HandleForceUpdate); 239 HandleForceUpdate);
@@ -242,14 +250,6 @@ namespace OpenSim
242 + "If an avatar name is given then only packets from that avatar are logged", 250 + "If an avatar name is given then only packets from that avatar are logged",
243 Debug); 251 Debug);
244 252
245 m_console.Commands.AddCommand("Comms", false, "debug http",
246 "debug http <level>",
247 "Turn on inbound http request debugging for everything except the event queue (see debug eq).",
248 "If level >= 2 then the handler used to service the request is logged.\n"
249 + "If level >= 1 then incoming HTTP requests are logged.\n"
250 + "If level <= 0 then no extra http logging is done.\n",
251 Debug);
252
253 m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); 253 m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
254 254
255 m_console.Commands.AddCommand("Regions", false, "debug scene", 255 m_console.Commands.AddCommand("Regions", false, "debug scene",
@@ -306,7 +306,7 @@ namespace OpenSim
306 + " If this is not given then the oar is saved to region.oar in the current directory.", 306 + " If this is not given then the oar is saved to region.oar in the current directory.",
307 SaveOar); 307 SaveOar);
308 308
309 m_console.Commands.AddCommand("Regions", false, "edit scale", 309 m_console.Commands.AddCommand("Objects", false, "edit scale",
310 "edit scale <name> <x> <y> <z>", 310 "edit scale <name> <x> <y> <z>",
311 "Change the scale of a named prim", HandleEditScale); 311 "Change the scale of a named prim", HandleEditScale);
312 312
@@ -349,7 +349,7 @@ namespace OpenSim
349 "show ratings", 349 "show ratings",
350 "Show rating data", HandleShow); 350 "Show rating data", HandleShow);
351 351
352 m_console.Commands.AddCommand("Regions", false, "backup", 352 m_console.Commands.AddCommand("Objects", false, "backup",
353 "backup", 353 "backup",
354 "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); 354 "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand);
355 355
@@ -410,7 +410,7 @@ namespace OpenSim
410 "modules unload <name>", 410 "modules unload <name>",
411 "Unload a module", HandleModules); 411 "Unload a module", HandleModules);
412 412
413 m_console.Commands.AddCommand("Regions", false, "kill uuid", 413 m_console.Commands.AddCommand("Objects", false, "kill uuid",
414 "kill uuid <UUID>", 414 "kill uuid <UUID>",
415 "Kill an object by UUID", KillUUID); 415 "Kill an object by UUID", KillUUID);
416 } 416 }
@@ -437,12 +437,16 @@ namespace OpenSim
437 } 437 }
438 } 438 }
439 439
440 private void WatchdogTimeoutHandler(System.Threading.Thread thread, int lastTick) 440 private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
441 { 441 {
442 int now = Environment.TickCount & Int32.MaxValue; 442 int now = Environment.TickCount & Int32.MaxValue;
443 443
444 m_log.ErrorFormat("[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago", 444 m_log.ErrorFormat(
445 thread.Name, thread.ThreadState, now - lastTick); 445 "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
446 twi.Thread.Name,
447 twi.Thread.ThreadState,
448 now - twi.LastTick,
449 twi.AlarmMethod != null ? string.Format("Data: {0}", twi.AlarmMethod()) : "");
446 } 450 }
447 451
448 #region Console Commands 452 #region Console Commands
@@ -481,10 +485,10 @@ namespace OpenSim
481 else 485 else
482 presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n"); 486 presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n");
483 487
484 // ...and close on our side
485 presence.Scene.IncomingCloseAgent(presence.UUID); 488 presence.Scene.IncomingCloseAgent(presence.UUID);
486 } 489 }
487 } 490 }
491
488 MainConsole.Instance.Output(""); 492 MainConsole.Instance.Output("");
489 } 493 }
490 494
@@ -618,10 +622,11 @@ namespace OpenSim
618 return; 622 return;
619 } 623 }
620 624
621 PopulateRegionEstateInfo(regInfo); 625 bool changed = PopulateRegionEstateInfo(regInfo);
622 IScene scene; 626 IScene scene;
623 CreateRegion(regInfo, true, out scene); 627 CreateRegion(regInfo, true, out scene);
624 regInfo.EstateSettings.Save(); 628 if (changed)
629 regInfo.EstateSettings.Save();
625 } 630 }
626 631
627 /// <summary> 632 /// <summary>
@@ -903,21 +908,6 @@ namespace OpenSim
903 908
904 break; 909 break;
905 910
906 case "http":
907 if (args.Length == 3)
908 {
909 int newDebug;
910 if (int.TryParse(args[2], out newDebug))
911 {
912 MainServer.Instance.DebugLevel = newDebug;
913 MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
914 break;
915 }
916 }
917
918 MainConsole.Instance.Output("Usage: debug http 0..2");
919 break;
920
921 case "scene": 911 case "scene":
922 if (args.Length == 4) 912 if (args.Length == 4)
923 { 913 {
@@ -969,8 +959,7 @@ namespace OpenSim
969 if (showParams.Length > 1 && showParams[1] == "full") 959 if (showParams.Length > 1 && showParams[1] == "full")
970 { 960 {
971 agents = m_sceneManager.GetCurrentScenePresences(); 961 agents = m_sceneManager.GetCurrentScenePresences();
972 } 962 } else
973 else
974 { 963 {
975 agents = m_sceneManager.GetCurrentSceneAvatars(); 964 agents = m_sceneManager.GetCurrentSceneAvatars();
976 } 965 }
@@ -979,7 +968,8 @@ namespace OpenSim
979 968
980 MainConsole.Instance.Output( 969 MainConsole.Instance.Output(
981 String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname", 970 String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname",
982 "Agent ID", "Root/Child", "Region", "Position")); 971 "Agent ID", "Root/Child", "Region", "Position")
972 );
983 973
984 foreach (ScenePresence presence in agents) 974 foreach (ScenePresence presence in agents)
985 { 975 {
@@ -989,8 +979,7 @@ namespace OpenSim
989 if (regionInfo == null) 979 if (regionInfo == null)
990 { 980 {
991 regionName = "Unresolvable"; 981 regionName = "Unresolvable";
992 } 982 } else
993 else
994 { 983 {
995 regionName = regionInfo.RegionName; 984 regionName = regionInfo.RegionName;
996 } 985 }
@@ -1003,7 +992,8 @@ namespace OpenSim
1003 presence.UUID, 992 presence.UUID,
1004 presence.IsChildAgent ? "Child" : "Root", 993 presence.IsChildAgent ? "Child" : "Root",
1005 regionName, 994 regionName,
1006 presence.AbsolutePosition.ToString())); 995 presence.AbsolutePosition.ToString())
996 );
1007 } 997 }
1008 998
1009 MainConsole.Instance.Output(String.Empty); 999 MainConsole.Instance.Output(String.Empty);
@@ -1012,16 +1002,20 @@ namespace OpenSim
1012 case "connections": 1002 case "connections":
1013 System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n"); 1003 System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n");
1014 m_sceneManager.ForEachScene( 1004 m_sceneManager.ForEachScene(
1015 delegate(Scene scene) 1005 delegate(Scene scene) {
1016 { 1006 scene.ForEachClient(
1017 scene.ForEachClient( 1007 delegate(IClientAPI client) {
1018 delegate(IClientAPI client) 1008 connections.AppendFormat(
1019 { 1009 "{0}: {1} ({2}) from {3} on circuit {4}\n",
1020 connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", 1010 scene.RegionInfo.RegionName,
1021 scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); 1011 client.Name,
1022 } 1012 client.AgentId,
1013 client.RemoteEndPoint,
1014 client.CircuitCode
1023 ); 1015 );
1024 } 1016 }
1017 );
1018 }
1025 ); 1019 );
1026 1020
1027 MainConsole.Instance.Output(connections.ToString()); 1021 MainConsole.Instance.Output(connections.ToString());
@@ -1030,13 +1024,17 @@ namespace OpenSim
1030 case "circuits": 1024 case "circuits":
1031 System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); 1025 System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n");
1032 m_sceneManager.ForEachScene( 1026 m_sceneManager.ForEachScene(
1033 delegate(Scene scene) 1027 delegate(Scene scene) {
1034 { 1028 //this.HttpServer.
1035 //this.HttpServer. 1029 acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName);
1036 acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); 1030 foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values)
1037 foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values) 1031 acd.AppendFormat(
1038 acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); 1032 "\t{0} {1} ({2})\n",
1039 } 1033 aCircuit.firstname,
1034 aCircuit.lastname,
1035 (aCircuit.child ? "Child" : "Root")
1036 );
1037 }
1040 ); 1038 );
1041 1039
1042 MainConsole.Instance.Output(acd.ToString()); 1040 MainConsole.Instance.Output(acd.ToString());
@@ -1077,17 +1075,29 @@ namespace OpenSim
1077 } 1075 }
1078 1076
1079 m_sceneManager.ForEachScene( 1077 m_sceneManager.ForEachScene(
1080 delegate(Scene scene) 1078 delegate(Scene scene) {
1079 m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
1080 foreach (IRegionModule module in scene.Modules.Values)
1081 { 1081 {
1082 m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); 1082 if (!module.IsSharedModule)
1083 foreach (IRegionModule module in scene.Modules.Values)
1084 { 1083 {
1085 if (!module.IsSharedModule) 1084 m_log.Error("Region Module: " + module.Name);
1086 {
1087 m_log.Error("Region Module: " + module.Name);
1088 }
1089 } 1085 }
1090 }); 1086 }
1087 }
1088 );
1089
1090 m_sceneManager.ForEachScene(
1091 delegate(Scene scene) {
1092 MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:");
1093 foreach (IRegionModuleBase module in scene.RegionModules.Values)
1094 {
1095 Type type = module.GetType().GetInterface("ISharedRegionModule");
1096 string module_type = type != null ? "Shared" : "Non-Shared";
1097 MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name);
1098 }
1099 }
1100 );
1091 1101
1092 MainConsole.Instance.Output(""); 1102 MainConsole.Instance.Output("");
1093 break; 1103 break;