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.cs198
1 files changed, 76 insertions, 122 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index fb1e831..1458ff9 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,12 +231,14 @@ 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);
232 240
233 m_console.Commands.AddCommand("Comms", false, "debug packet", 241 m_console.Commands.AddCommand("Debug", false, "debug packet",
234 "debug packet <level> [<avatar-first-name> <avatar-last-name>]", 242 "debug packet <level> [<avatar-first-name> <avatar-last-name>]",
235 "Turn on packet debugging", 243 "Turn on packet debugging",
236 "If level > 255 then all incoming and outgoing packets are logged.\n" 244 "If level > 255 then all incoming and outgoing packets are logged.\n"
@@ -242,17 +250,9 @@ 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", 253 m_console.Commands.AddCommand("Debug", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
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);
254 254
255 m_console.Commands.AddCommand("Regions", false, "debug scene", 255 m_console.Commands.AddCommand("Debug", false, "debug scene",
256 "debug scene <scripting> <collisions> <physics>", 256 "debug scene <scripting> <collisions> <physics>",
257 "Turn on scene debugging", Debug); 257 "Turn on scene debugging", Debug);
258 258
@@ -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
@@ -409,10 +409,6 @@ namespace OpenSim
409 m_console.Commands.AddCommand("General", false, "modules unload", 409 m_console.Commands.AddCommand("General", false, "modules unload",
410 "modules unload <name>", 410 "modules unload <name>",
411 "Unload a module", HandleModules); 411 "Unload a module", HandleModules);
412
413 m_console.Commands.AddCommand("Regions", false, "kill uuid",
414 "kill uuid <UUID>",
415 "Kill an object by UUID", KillUUID);
416 } 412 }
417 413
418 public override void ShutdownSpecific() 414 public override void ShutdownSpecific()
@@ -437,12 +433,16 @@ namespace OpenSim
437 } 433 }
438 } 434 }
439 435
440 private void WatchdogTimeoutHandler(System.Threading.Thread thread, int lastTick) 436 private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
441 { 437 {
442 int now = Environment.TickCount & Int32.MaxValue; 438 int now = Environment.TickCount & Int32.MaxValue;
443 439
444 m_log.ErrorFormat("[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago", 440 m_log.ErrorFormat(
445 thread.Name, thread.ThreadState, now - lastTick); 441 "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
442 twi.Thread.Name,
443 twi.Thread.ThreadState,
444 now - twi.LastTick,
445 twi.AlarmMethod != null ? string.Format("Data: {0}", twi.AlarmMethod()) : "");
446 } 446 }
447 447
448 #region Console Commands 448 #region Console Commands
@@ -481,10 +481,10 @@ namespace OpenSim
481 else 481 else
482 presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n"); 482 presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n");
483 483
484 // ...and close on our side
485 presence.Scene.IncomingCloseAgent(presence.UUID); 484 presence.Scene.IncomingCloseAgent(presence.UUID);
486 } 485 }
487 } 486 }
487
488 MainConsole.Instance.Output(""); 488 MainConsole.Instance.Output("");
489 } 489 }
490 490
@@ -618,10 +618,11 @@ namespace OpenSim
618 return; 618 return;
619 } 619 }
620 620
621 PopulateRegionEstateInfo(regInfo); 621 bool changed = PopulateRegionEstateInfo(regInfo);
622 IScene scene; 622 IScene scene;
623 CreateRegion(regInfo, true, out scene); 623 CreateRegion(regInfo, true, out scene);
624 regInfo.EstateSettings.Save(); 624 if (changed)
625 regInfo.EstateSettings.Save();
625 } 626 }
626 627
627 /// <summary> 628 /// <summary>
@@ -903,21 +904,6 @@ namespace OpenSim
903 904
904 break; 905 break;
905 906
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": 907 case "scene":
922 if (args.Length == 4) 908 if (args.Length == 4)
923 { 909 {
@@ -969,8 +955,7 @@ namespace OpenSim
969 if (showParams.Length > 1 && showParams[1] == "full") 955 if (showParams.Length > 1 && showParams[1] == "full")
970 { 956 {
971 agents = m_sceneManager.GetCurrentScenePresences(); 957 agents = m_sceneManager.GetCurrentScenePresences();
972 } 958 } else
973 else
974 { 959 {
975 agents = m_sceneManager.GetCurrentSceneAvatars(); 960 agents = m_sceneManager.GetCurrentSceneAvatars();
976 } 961 }
@@ -979,7 +964,8 @@ namespace OpenSim
979 964
980 MainConsole.Instance.Output( 965 MainConsole.Instance.Output(
981 String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname", 966 String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname",
982 "Agent ID", "Root/Child", "Region", "Position")); 967 "Agent ID", "Root/Child", "Region", "Position")
968 );
983 969
984 foreach (ScenePresence presence in agents) 970 foreach (ScenePresence presence in agents)
985 { 971 {
@@ -989,8 +975,7 @@ namespace OpenSim
989 if (regionInfo == null) 975 if (regionInfo == null)
990 { 976 {
991 regionName = "Unresolvable"; 977 regionName = "Unresolvable";
992 } 978 } else
993 else
994 { 979 {
995 regionName = regionInfo.RegionName; 980 regionName = regionInfo.RegionName;
996 } 981 }
@@ -1003,7 +988,8 @@ namespace OpenSim
1003 presence.UUID, 988 presence.UUID,
1004 presence.IsChildAgent ? "Child" : "Root", 989 presence.IsChildAgent ? "Child" : "Root",
1005 regionName, 990 regionName,
1006 presence.AbsolutePosition.ToString())); 991 presence.AbsolutePosition.ToString())
992 );
1007 } 993 }
1008 994
1009 MainConsole.Instance.Output(String.Empty); 995 MainConsole.Instance.Output(String.Empty);
@@ -1012,16 +998,20 @@ namespace OpenSim
1012 case "connections": 998 case "connections":
1013 System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n"); 999 System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n");
1014 m_sceneManager.ForEachScene( 1000 m_sceneManager.ForEachScene(
1015 delegate(Scene scene) 1001 delegate(Scene scene) {
1016 { 1002 scene.ForEachClient(
1017 scene.ForEachClient( 1003 delegate(IClientAPI client) {
1018 delegate(IClientAPI client) 1004 connections.AppendFormat(
1019 { 1005 "{0}: {1} ({2}) from {3} on circuit {4}\n",
1020 connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", 1006 scene.RegionInfo.RegionName,
1021 scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); 1007 client.Name,
1022 } 1008 client.AgentId,
1009 client.RemoteEndPoint,
1010 client.CircuitCode
1023 ); 1011 );
1024 } 1012 }
1013 );
1014 }
1025 ); 1015 );
1026 1016
1027 MainConsole.Instance.Output(connections.ToString()); 1017 MainConsole.Instance.Output(connections.ToString());
@@ -1030,13 +1020,17 @@ namespace OpenSim
1030 case "circuits": 1020 case "circuits":
1031 System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); 1021 System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n");
1032 m_sceneManager.ForEachScene( 1022 m_sceneManager.ForEachScene(
1033 delegate(Scene scene) 1023 delegate(Scene scene) {
1034 { 1024 //this.HttpServer.
1035 //this.HttpServer. 1025 acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName);
1036 acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); 1026 foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values)
1037 foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values) 1027 acd.AppendFormat(
1038 acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); 1028 "\t{0} {1} ({2})\n",
1039 } 1029 aCircuit.firstname,
1030 aCircuit.lastname,
1031 (aCircuit.child ? "Child" : "Root")
1032 );
1033 }
1040 ); 1034 );
1041 1035
1042 MainConsole.Instance.Output(acd.ToString()); 1036 MainConsole.Instance.Output(acd.ToString());
@@ -1077,17 +1071,29 @@ namespace OpenSim
1077 } 1071 }
1078 1072
1079 m_sceneManager.ForEachScene( 1073 m_sceneManager.ForEachScene(
1080 delegate(Scene scene) 1074 delegate(Scene scene) {
1075 m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
1076 foreach (IRegionModule module in scene.Modules.Values)
1081 { 1077 {
1082 m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); 1078 if (!module.IsSharedModule)
1083 foreach (IRegionModule module in scene.Modules.Values)
1084 { 1079 {
1085 if (!module.IsSharedModule) 1080 m_log.Error("Region Module: " + module.Name);
1086 {
1087 m_log.Error("Region Module: " + module.Name);
1088 }
1089 } 1081 }
1090 }); 1082 }
1083 }
1084 );
1085
1086 m_sceneManager.ForEachScene(
1087 delegate(Scene scene) {
1088 MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:");
1089 foreach (IRegionModuleBase module in scene.RegionModules.Values)
1090 {
1091 Type type = module.GetType().GetInterface("ISharedRegionModule");
1092 string module_type = type != null ? "Shared" : "Non-Shared";
1093 MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name);
1094 }
1095 }
1096 );
1091 1097
1092 MainConsole.Instance.Output(""); 1098 MainConsole.Instance.Output("");
1093 break; 1099 break;
@@ -1299,58 +1305,6 @@ namespace OpenSim
1299 return result; 1305 return result;
1300 } 1306 }
1301 1307
1302 /// <summary>
1303 /// Kill an object given its UUID.
1304 /// </summary>
1305 /// <param name="cmdparams"></param>
1306 protected void KillUUID(string module, string[] cmdparams)
1307 {
1308 if (cmdparams.Length > 2)
1309 {
1310 UUID id = UUID.Zero;
1311 SceneObjectGroup grp = null;
1312 Scene sc = null;
1313
1314 if (!UUID.TryParse(cmdparams[2], out id))
1315 {
1316 MainConsole.Instance.Output("[KillUUID]: Error bad UUID format!");
1317 return;
1318 }
1319
1320 m_sceneManager.ForEachScene(
1321 delegate(Scene scene)
1322 {
1323 SceneObjectPart part = scene.GetSceneObjectPart(id);
1324 if (part == null)
1325 return;
1326
1327 grp = part.ParentGroup;
1328 sc = scene;
1329 });
1330
1331 if (grp == null)
1332 {
1333 MainConsole.Instance.Output(String.Format("[KillUUID]: Given UUID {0} not found!", id));
1334 }
1335 else
1336 {
1337 MainConsole.Instance.Output(String.Format("[KillUUID]: Found UUID {0} in scene {1}", id, sc.RegionInfo.RegionName));
1338 try
1339 {
1340 sc.DeleteSceneObject(grp, false);
1341 }
1342 catch (Exception e)
1343 {
1344 m_log.ErrorFormat("[KillUUID]: Error while removing objects from scene: " + e);
1345 }
1346 }
1347 }
1348 else
1349 {
1350 MainConsole.Instance.Output("[KillUUID]: Usage: kill uuid <UUID>");
1351 }
1352 }
1353
1354 #endregion 1308 #endregion
1355 } 1309 }
1356} 1310}