diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 236 |
1 files changed, 102 insertions, 134 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index fb1e831..e6b57c2 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | ||
31 | using System.IO; | 32 | using System.IO; |
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using System.Text; | 34 | using 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 | 254 | ||
253 | m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); | 255 | m_console.Commands.AddCommand("Debug", false, "debug scene", |
254 | |||
255 | m_console.Commands.AddCommand("Regions", 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,43 +988,19 @@ 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); |
1010 | break; | 996 | break; |
1011 | 997 | ||
1012 | case "connections": | 998 | case "connections": |
1013 | System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n"); | 999 | HandleShowConnections(); |
1014 | m_sceneManager.ForEachScene( | ||
1015 | delegate(Scene scene) | ||
1016 | { | ||
1017 | scene.ForEachClient( | ||
1018 | delegate(IClientAPI client) | ||
1019 | { | ||
1020 | connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", | ||
1021 | scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); | ||
1022 | } | ||
1023 | ); | ||
1024 | } | ||
1025 | ); | ||
1026 | |||
1027 | MainConsole.Instance.Output(connections.ToString()); | ||
1028 | break; | 1000 | break; |
1029 | 1001 | ||
1030 | case "circuits": | 1002 | case "circuits": |
1031 | System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); | 1003 | HandleShowCircuits(); |
1032 | m_sceneManager.ForEachScene( | ||
1033 | delegate(Scene scene) | ||
1034 | { | ||
1035 | //this.HttpServer. | ||
1036 | acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); | ||
1037 | foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values) | ||
1038 | acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); | ||
1039 | } | ||
1040 | ); | ||
1041 | |||
1042 | MainConsole.Instance.Output(acd.ToString()); | ||
1043 | break; | 1004 | break; |
1044 | 1005 | ||
1045 | case "http-handlers": | 1006 | case "http-handlers": |
@@ -1077,17 +1038,29 @@ namespace OpenSim | |||
1077 | } | 1038 | } |
1078 | 1039 | ||
1079 | m_sceneManager.ForEachScene( | 1040 | m_sceneManager.ForEachScene( |
1080 | delegate(Scene scene) | 1041 | delegate(Scene scene) { |
1042 | m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); | ||
1043 | foreach (IRegionModule module in scene.Modules.Values) | ||
1081 | { | 1044 | { |
1082 | m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); | 1045 | if (!module.IsSharedModule) |
1083 | foreach (IRegionModule module in scene.Modules.Values) | ||
1084 | { | 1046 | { |
1085 | if (!module.IsSharedModule) | 1047 | m_log.Error("Region Module: " + module.Name); |
1086 | { | ||
1087 | m_log.Error("Region Module: " + module.Name); | ||
1088 | } | ||
1089 | } | 1048 | } |
1090 | }); | 1049 | } |
1050 | } | ||
1051 | ); | ||
1052 | |||
1053 | m_sceneManager.ForEachScene( | ||
1054 | delegate(Scene scene) { | ||
1055 | MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:"); | ||
1056 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
1057 | { | ||
1058 | Type type = module.GetType().GetInterface("ISharedRegionModule"); | ||
1059 | string module_type = type != null ? "Shared" : "Non-Shared"; | ||
1060 | MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); | ||
1061 | } | ||
1062 | } | ||
1063 | ); | ||
1091 | 1064 | ||
1092 | MainConsole.Instance.Output(""); | 1065 | MainConsole.Instance.Output(""); |
1093 | break; | 1066 | break; |
@@ -1132,6 +1105,53 @@ namespace OpenSim | |||
1132 | } | 1105 | } |
1133 | } | 1106 | } |
1134 | 1107 | ||
1108 | private void HandleShowCircuits() | ||
1109 | { | ||
1110 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | ||
1111 | cdt.AddColumn("Region", 20); | ||
1112 | cdt.AddColumn("Avatar name", 24); | ||
1113 | cdt.AddColumn("Type", 5); | ||
1114 | cdt.AddColumn("Code", 10); | ||
1115 | cdt.AddColumn("IP", 16); | ||
1116 | cdt.AddColumn("Viewer Name", 24); | ||
1117 | |||
1118 | m_sceneManager.ForEachScene( | ||
1119 | s => | ||
1120 | { | ||
1121 | foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values) | ||
1122 | cdt.AddRow( | ||
1123 | s.Name, | ||
1124 | aCircuit.Name, | ||
1125 | aCircuit.child ? "child" : "root", | ||
1126 | aCircuit.circuitcode.ToString(), | ||
1127 | aCircuit.IPAddress.ToString(), | ||
1128 | aCircuit.Viewer); | ||
1129 | }); | ||
1130 | |||
1131 | MainConsole.Instance.Output(cdt.ToString()); | ||
1132 | } | ||
1133 | |||
1134 | private void HandleShowConnections() | ||
1135 | { | ||
1136 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | ||
1137 | cdt.AddColumn("Region", 20); | ||
1138 | cdt.AddColumn("Avatar name", 24); | ||
1139 | cdt.AddColumn("Circuit code", 12); | ||
1140 | cdt.AddColumn("Endpoint", 23); | ||
1141 | cdt.AddColumn("Active?", 7); | ||
1142 | |||
1143 | m_sceneManager.ForEachScene( | ||
1144 | s => s.ForEachClient( | ||
1145 | c => cdt.AddRow( | ||
1146 | s.Name, | ||
1147 | c.Name, | ||
1148 | c.RemoteEndPoint.ToString(), | ||
1149 | c.CircuitCode.ToString(), | ||
1150 | c.IsActive.ToString()))); | ||
1151 | |||
1152 | MainConsole.Instance.Output(cdt.ToString()); | ||
1153 | } | ||
1154 | |||
1135 | /// <summary> | 1155 | /// <summary> |
1136 | /// Use XML2 format to serialize data to a file | 1156 | /// Use XML2 format to serialize data to a file |
1137 | /// </summary> | 1157 | /// </summary> |
@@ -1299,58 +1319,6 @@ namespace OpenSim | |||
1299 | return result; | 1319 | return result; |
1300 | } | 1320 | } |
1301 | 1321 | ||
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 | 1322 | #endregion |
1355 | } | 1323 | } |
1356 | } | 1324 | } |