diff options
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/Application.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/Application/ConfigurationLoader.cs | 76 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 319 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 92 |
4 files changed, 299 insertions, 230 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index c3e7ec2..3a4e5df 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -103,48 +103,63 @@ namespace OpenSim | |||
103 | "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); | 103 | "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); |
104 | 104 | ||
105 | // Verify the Threadpool allocates or uses enough worker and IO completion threads | 105 | // Verify the Threadpool allocates or uses enough worker and IO completion threads |
106 | // .NET 2.0 workerthreads default to 50 * numcores | 106 | // .NET 2.0, workerthreads default to 50 * numcores |
107 | // .NET 3.0 workerthreads defaults to 250 * numcores | 107 | // .NET 3.0, workerthreads defaults to 250 * numcores |
108 | // .NET 4.0 workerthreads are dynamic based on bitness and OS resources | 108 | // .NET 4.0, workerthreads are dynamic based on bitness and OS resources |
109 | // Max IO Completion threads are 1000 on all 3 CLRs. | 109 | // Max IO Completion threads are 1000 on all 3 CLRs |
110 | // | ||
111 | // Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores | ||
110 | int workerThreadsMin = 500; | 112 | int workerThreadsMin = 500; |
111 | int workerThreadsMax = 1000; // may need further adjustment to match other CLR | 113 | int workerThreadsMax = 1000; // may need further adjustment to match other CLR |
112 | int iocpThreadsMin = 1000; | 114 | int iocpThreadsMin = 1000; |
113 | int iocpThreadsMax = 2000; // may need further adjustment to match other CLR | 115 | int iocpThreadsMax = 2000; // may need further adjustment to match other CLR |
116 | |||
117 | { | ||
118 | int currentMinWorkerThreads, currentMinIocpThreads; | ||
119 | System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads); | ||
120 | m_log.InfoFormat( | ||
121 | "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads", | ||
122 | currentMinWorkerThreads, currentMinIocpThreads); | ||
123 | } | ||
124 | |||
114 | int workerThreads, iocpThreads; | 125 | int workerThreads, iocpThreads; |
115 | System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); | 126 | System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); |
116 | m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads); | 127 | m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} max worker threads and {1} max IOCP threads", workerThreads, iocpThreads); |
128 | |||
117 | if (workerThreads < workerThreadsMin) | 129 | if (workerThreads < workerThreadsMin) |
118 | { | 130 | { |
119 | workerThreads = workerThreadsMin; | 131 | workerThreads = workerThreadsMin; |
120 | m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to worker threads to {0}",workerThreads); | 132 | m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to max worker threads to {0}",workerThreads); |
121 | } | 133 | } |
122 | if (workerThreads > workerThreadsMax) | 134 | if (workerThreads > workerThreadsMax) |
123 | { | 135 | { |
124 | workerThreads = workerThreadsMax; | 136 | workerThreads = workerThreadsMax; |
125 | m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads); | 137 | m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads); |
126 | } | 138 | } |
139 | |||
127 | // Increase the number of IOCP threads available. | 140 | // Increase the number of IOCP threads available. |
128 | // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) | 141 | // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) |
129 | if (iocpThreads < iocpThreadsMin) | 142 | if (iocpThreads < iocpThreadsMin) |
130 | { | 143 | { |
131 | iocpThreads = iocpThreadsMin; | 144 | iocpThreads = iocpThreadsMin; |
132 | m_log.InfoFormat("[OPENSIM MAIN]: Bumping up IO completion threads to {0}",iocpThreads); | 145 | m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads); |
133 | } | 146 | } |
134 | // Make sure we don't overallocate IOCP threads and thrash system resources | 147 | // Make sure we don't overallocate IOCP threads and thrash system resources |
135 | if ( iocpThreads > iocpThreadsMax ) | 148 | if ( iocpThreads > iocpThreadsMax ) |
136 | { | 149 | { |
137 | iocpThreads = iocpThreadsMax; | 150 | iocpThreads = iocpThreadsMax; |
138 | m_log.InfoFormat("[OPENSIM MAIN]: Limiting IO completion threads to {0}",iocpThreads); | 151 | m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads); |
139 | } | 152 | } |
140 | // set the resulting worker and IO completion thread counts back to ThreadPool | 153 | // set the resulting worker and IO completion thread counts back to ThreadPool |
141 | if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) ) | 154 | if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) ) |
142 | { | 155 | { |
143 | m_log.InfoFormat("[OPENSIM MAIN]: Threadpool set to {0} worker threads and {1} IO completion threads", workerThreads, iocpThreads); | 156 | m_log.InfoFormat( |
157 | "[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads", | ||
158 | workerThreads, iocpThreads); | ||
144 | } | 159 | } |
145 | else | 160 | else |
146 | { | 161 | { |
147 | m_log.Info("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect."); | 162 | m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect."); |
148 | } | 163 | } |
149 | 164 | ||
150 | // Check if the system is compatible with OpenSimulator. | 165 | // Check if the system is compatible with OpenSimulator. |
@@ -152,17 +167,16 @@ namespace OpenSim | |||
152 | string supported = String.Empty; | 167 | string supported = String.Empty; |
153 | if (Util.IsEnvironmentSupported(ref supported)) | 168 | if (Util.IsEnvironmentSupported(ref supported)) |
154 | { | 169 | { |
155 | m_log.Info("Environment is compatible.\n"); | 170 | m_log.Info("[OPENSIM MAIN]: Environment is supported by OpenSimulator."); |
156 | } | 171 | } |
157 | else | 172 | else |
158 | { | 173 | { |
159 | m_log.Warn("Environment is unsupported (" + supported + ")\n"); | 174 | m_log.Warn("[OPENSIM MAIN]: Environment is not supported by OpenSimulator (" + supported + ")\n"); |
160 | } | 175 | } |
161 | 176 | ||
162 | // Configure nIni aliases and localles | 177 | // Configure nIni aliases and localles |
163 | Culture.SetCurrentCulture(); | 178 | Culture.SetCurrentCulture(); |
164 | 179 | ||
165 | |||
166 | // Validate that the user has the most basic configuration done | 180 | // Validate that the user has the most basic configuration done |
167 | // If not, offer to do the most basic configuration for them warning them along the way of the importance of | 181 | // If not, offer to do the most basic configuration for them warning them along the way of the importance of |
168 | // reading these files. | 182 | // reading these files. |
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index fc3999f..52e520c 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs | |||
@@ -124,7 +124,7 @@ namespace OpenSim | |||
124 | else | 124 | else |
125 | { | 125 | { |
126 | Application.iniFilePath = Path.GetFullPath( | 126 | Application.iniFilePath = Path.GetFullPath( |
127 | Path.Combine(Util.configDir(), iniFileName)); | 127 | Path.Combine(Util.configDir(), iniFileName)); |
128 | 128 | ||
129 | if (!File.Exists(Application.iniFilePath)) | 129 | if (!File.Exists(Application.iniFilePath)) |
130 | { | 130 | { |
@@ -139,12 +139,29 @@ namespace OpenSim | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | m_config = new OpenSimConfigSource(); | ||
143 | m_config.Source = new IniConfigSource(); | ||
144 | m_config.Source.Merge(DefaultConfig()); | ||
145 | |||
146 | m_log.Info("[CONFIG]: Reading configuration settings"); | ||
147 | |||
148 | for (int i = 0 ; i < sources.Count ; i++) | ||
149 | { | ||
150 | if (ReadConfig(m_config, sources[i])) | ||
151 | { | ||
152 | iniFileExists = true; | ||
153 | AddIncludes(m_config, sources); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | // Override distro settings with contents of inidirectory | ||
142 | string iniDirName = startupConfig.GetString("inidirectory", "config"); | 158 | string iniDirName = startupConfig.GetString("inidirectory", "config"); |
143 | string iniDirPath = Path.Combine(Util.configDir(), iniDirName); | 159 | string iniDirPath = Path.Combine(Util.configDir(), iniDirName); |
144 | 160 | ||
145 | if (Directory.Exists(iniDirPath)) | 161 | if (Directory.Exists(iniDirPath)) |
146 | { | 162 | { |
147 | m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath); | 163 | m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath); |
164 | List<string> overrideSources = new List<string>(); | ||
148 | 165 | ||
149 | string[] fileEntries = Directory.GetFiles(iniDirName); | 166 | string[] fileEntries = Directory.GetFiles(iniDirName); |
150 | foreach (string filePath in fileEntries) | 167 | foreach (string filePath in fileEntries) |
@@ -152,33 +169,38 @@ namespace OpenSim | |||
152 | if (Path.GetExtension(filePath).ToLower() == ".ini") | 169 | if (Path.GetExtension(filePath).ToLower() == ".ini") |
153 | { | 170 | { |
154 | if (!sources.Contains(Path.GetFullPath(filePath))) | 171 | if (!sources.Contains(Path.GetFullPath(filePath))) |
172 | { | ||
173 | overrideSources.Add(Path.GetFullPath(filePath)); | ||
174 | // put it in sources too, to avoid circularity | ||
155 | sources.Add(Path.GetFullPath(filePath)); | 175 | sources.Add(Path.GetFullPath(filePath)); |
176 | } | ||
156 | } | 177 | } |
157 | } | 178 | } |
158 | } | ||
159 | 179 | ||
160 | m_config = new OpenSimConfigSource(); | ||
161 | m_config.Source = new IniConfigSource(); | ||
162 | m_config.Source.Merge(DefaultConfig()); | ||
163 | 180 | ||
164 | m_log.Info("[CONFIG]: Reading configuration settings"); | 181 | if (overrideSources.Count > 0) |
182 | { | ||
183 | OpenSimConfigSource overrideConfig = new OpenSimConfigSource(); | ||
184 | overrideConfig.Source = new IniConfigSource(); | ||
185 | |||
186 | for (int i = 0 ; i < overrideSources.Count ; i++) | ||
187 | { | ||
188 | if (ReadConfig(overrideConfig, overrideSources[i])) | ||
189 | { | ||
190 | iniFileExists = true; | ||
191 | AddIncludes(overrideConfig, overrideSources); | ||
192 | } | ||
193 | } | ||
194 | m_config.Source.Merge(overrideConfig.Source); | ||
195 | } | ||
196 | } | ||
165 | 197 | ||
166 | if (sources.Count == 0) | 198 | if (sources.Count == 0) |
167 | { | 199 | { |
168 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); | 200 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); |
169 | Environment.Exit(1); | 201 | Environment.Exit(1); |
170 | } | 202 | } |
171 | 203 | else if (!iniFileExists) | |
172 | for (int i = 0 ; i < sources.Count ; i++) | ||
173 | { | ||
174 | if (ReadConfig(sources[i])) | ||
175 | { | ||
176 | iniFileExists = true; | ||
177 | AddIncludes(sources); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | if (!iniFileExists) | ||
182 | { | 204 | { |
183 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); | 205 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); |
184 | m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); | 206 | m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); |
@@ -201,9 +223,9 @@ namespace OpenSim | |||
201 | 223 | ||
202 | envConfigSource.LoadEnv(); | 224 | envConfigSource.LoadEnv(); |
203 | m_config.Source.Merge(envConfigSource); | 225 | m_config.Source.Merge(envConfigSource); |
204 | m_config.Source.ExpandKeyValues(); | ||
205 | } | 226 | } |
206 | 227 | ||
228 | m_config.Source.ExpandKeyValues(); | ||
207 | 229 | ||
208 | ReadConfigSettings(); | 230 | ReadConfigSettings(); |
209 | 231 | ||
@@ -214,10 +236,10 @@ namespace OpenSim | |||
214 | /// Adds the included files as ini configuration files | 236 | /// Adds the included files as ini configuration files |
215 | /// </summary> | 237 | /// </summary> |
216 | /// <param name="sources">List of URL strings or filename strings</param> | 238 | /// <param name="sources">List of URL strings or filename strings</param> |
217 | private void AddIncludes(List<string> sources) | 239 | private void AddIncludes(OpenSimConfigSource configSource, List<string> sources) |
218 | { | 240 | { |
219 | //loop over config sources | 241 | //loop over config sources |
220 | foreach (IConfig config in m_config.Source.Configs) | 242 | foreach (IConfig config in configSource.Source.Configs) |
221 | { | 243 | { |
222 | // Look for Include-* in the key name | 244 | // Look for Include-* in the key name |
223 | string[] keys = config.GetKeys(); | 245 | string[] keys = config.GetKeys(); |
@@ -284,7 +306,7 @@ namespace OpenSim | |||
284 | /// </summary> | 306 | /// </summary> |
285 | /// <param name="iniPath">Full path to the ini</param> | 307 | /// <param name="iniPath">Full path to the ini</param> |
286 | /// <returns></returns> | 308 | /// <returns></returns> |
287 | private bool ReadConfig(string iniPath) | 309 | private bool ReadConfig(OpenSimConfigSource configSource, string iniPath) |
288 | { | 310 | { |
289 | bool success = false; | 311 | bool success = false; |
290 | 312 | ||
@@ -292,7 +314,7 @@ namespace OpenSim | |||
292 | { | 314 | { |
293 | m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); | 315 | m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); |
294 | 316 | ||
295 | m_config.Source.Merge(new IniConfigSource(iniPath)); | 317 | configSource.Source.Merge(new IniConfigSource(iniPath)); |
296 | success = true; | 318 | success = true; |
297 | } | 319 | } |
298 | else | 320 | else |
@@ -305,7 +327,7 @@ namespace OpenSim | |||
305 | { | 327 | { |
306 | XmlReader r = XmlReader.Create(iniPath); | 328 | XmlReader r = XmlReader.Create(iniPath); |
307 | XmlConfigSource cs = new XmlConfigSource(r); | 329 | XmlConfigSource cs = new XmlConfigSource(r); |
308 | m_config.Source.Merge(cs); | 330 | configSource.Source.Merge(cs); |
309 | 331 | ||
310 | success = true; | 332 | success = true; |
311 | } | 333 | } |
@@ -337,10 +359,7 @@ namespace OpenSim | |||
337 | config.Set("physics", "OpenDynamicsEngine"); | 359 | config.Set("physics", "OpenDynamicsEngine"); |
338 | config.Set("meshing", "Meshmerizer"); | 360 | config.Set("meshing", "Meshmerizer"); |
339 | config.Set("physical_prim", true); | 361 | config.Set("physical_prim", true); |
340 | config.Set("see_into_this_sim_from_neighbor", true); | ||
341 | config.Set("serverside_object_permissions", true); | 362 | config.Set("serverside_object_permissions", true); |
342 | config.Set("storage_plugin", "OpenSim.Data.SQLite.dll"); | ||
343 | config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3"); | ||
344 | config.Set("storage_prim_inventories", true); | 363 | config.Set("storage_prim_inventories", true); |
345 | config.Set("startup_console_commands_file", String.Empty); | 364 | config.Set("startup_console_commands_file", String.Empty); |
346 | config.Set("shutdown_console_commands_file", String.Empty); | 365 | config.Set("shutdown_console_commands_file", String.Empty); |
@@ -372,7 +391,6 @@ namespace OpenSim | |||
372 | { | 391 | { |
373 | m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); | 392 | m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); |
374 | m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); | 393 | m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); |
375 | m_configSettings.StorageDll = startupConfig.GetString("storage_plugin"); | ||
376 | 394 | ||
377 | m_configSettings.ClientstackDll | 395 | m_configSettings.ClientstackDll |
378 | = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); | 396 | = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index a7e7d03..e1e3d87 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -86,6 +86,7 @@ namespace OpenSim | |||
86 | IConfig startupConfig = Config.Configs["Startup"]; | 86 | IConfig startupConfig = Config.Configs["Startup"]; |
87 | IConfig networkConfig = Config.Configs["Network"]; | 87 | IConfig networkConfig = Config.Configs["Network"]; |
88 | 88 | ||
89 | int stpMinThreads = 2; | ||
89 | int stpMaxThreads = 15; | 90 | int stpMaxThreads = 15; |
90 | 91 | ||
91 | if (startupConfig != null) | 92 | if (startupConfig != null) |
@@ -112,12 +113,13 @@ namespace OpenSim | |||
112 | if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) | 113 | if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) |
113 | Util.FireAndForgetMethod = asyncCallMethod; | 114 | Util.FireAndForgetMethod = asyncCallMethod; |
114 | 115 | ||
116 | stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15); | ||
115 | stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); | 117 | stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); |
116 | m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); | 118 | m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); |
117 | } | 119 | } |
118 | 120 | ||
119 | if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) | 121 | if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) |
120 | Util.InitThreadPool(stpMaxThreads); | 122 | Util.InitThreadPool(stpMinThreads, stpMaxThreads); |
121 | 123 | ||
122 | m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); | 124 | m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); |
123 | } | 125 | } |
@@ -170,6 +172,13 @@ namespace OpenSim | |||
170 | if (userStatsURI != String.Empty) | 172 | if (userStatsURI != String.Empty) |
171 | MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); | 173 | MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); |
172 | 174 | ||
175 | if (managedStatsURI != String.Empty) | ||
176 | { | ||
177 | string urlBase = String.Format("/{0}/", managedStatsURI); | ||
178 | MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest); | ||
179 | m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase); | ||
180 | } | ||
181 | |||
173 | if (m_console is RemoteConsole) | 182 | if (m_console is RemoteConsole) |
174 | { | 183 | { |
175 | if (m_consolePort == 0) | 184 | if (m_consolePort == 0) |
@@ -226,41 +235,35 @@ namespace OpenSim | |||
226 | "Force the update of all objects on clients", | 235 | "Force the update of all objects on clients", |
227 | HandleForceUpdate); | 236 | HandleForceUpdate); |
228 | 237 | ||
229 | m_console.Commands.AddCommand("Debug", false, "debug packet", | ||
230 | "debug packet <level> [<avatar-first-name> <avatar-last-name>]", | ||
231 | "Turn on packet debugging", | ||
232 | "If level > 255 then all incoming and outgoing packets are logged.\n" | ||
233 | + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" | ||
234 | + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" | ||
235 | + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" | ||
236 | + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" | ||
237 | + "If level <= 0 then no packets are logged.\n" | ||
238 | + "If an avatar name is given then only packets from that avatar are logged", | ||
239 | Debug); | ||
240 | |||
241 | m_console.Commands.AddCommand("General", false, "change region", | 238 | m_console.Commands.AddCommand("General", false, "change region", |
242 | "change region <region name>", | 239 | "change region <region name>", |
243 | "Change current console region", ChangeSelectedRegion); | 240 | "Change current console region", |
241 | ChangeSelectedRegion); | ||
244 | 242 | ||
245 | m_console.Commands.AddCommand("Archiving", false, "save xml", | 243 | m_console.Commands.AddCommand("Archiving", false, "save xml", |
246 | "save xml", | 244 | "save xml", |
247 | "Save a region's data in XML format", SaveXml); | 245 | "Save a region's data in XML format", |
246 | SaveXml); | ||
248 | 247 | ||
249 | m_console.Commands.AddCommand("Archiving", false, "save xml2", | 248 | m_console.Commands.AddCommand("Archiving", false, "save xml2", |
250 | "save xml2", | 249 | "save xml2", |
251 | "Save a region's data in XML2 format", SaveXml2); | 250 | "Save a region's data in XML2 format", |
251 | SaveXml2); | ||
252 | 252 | ||
253 | m_console.Commands.AddCommand("Archiving", false, "load xml", | 253 | m_console.Commands.AddCommand("Archiving", false, "load xml", |
254 | "load xml [-newIDs [<x> <y> <z>]]", | 254 | "load xml [-newIDs [<x> <y> <z>]]", |
255 | "Load a region's data from XML format", LoadXml); | 255 | "Load a region's data from XML format", |
256 | LoadXml); | ||
256 | 257 | ||
257 | m_console.Commands.AddCommand("Archiving", false, "load xml2", | 258 | m_console.Commands.AddCommand("Archiving", false, "load xml2", |
258 | "load xml2", | 259 | "load xml2", |
259 | "Load a region's data from XML2 format", LoadXml2); | 260 | "Load a region's data from XML2 format", |
261 | LoadXml2); | ||
260 | 262 | ||
261 | m_console.Commands.AddCommand("Archiving", false, "save prims xml2", | 263 | m_console.Commands.AddCommand("Archiving", false, "save prims xml2", |
262 | "save prims xml2 [<prim name> <file name>]", | 264 | "save prims xml2 [<prim name> <file name>]", |
263 | "Save named prim to XML2", SavePrimsXml2); | 265 | "Save named prim to XML2", |
266 | SavePrimsXml2); | ||
264 | 267 | ||
265 | m_console.Commands.AddCommand("Archiving", false, "load oar", | 268 | m_console.Commands.AddCommand("Archiving", false, "load oar", |
266 | "load oar [--merge] [--skip-assets] [<OAR path>]", | 269 | "load oar [--merge] [--skip-assets] [<OAR path>]", |
@@ -290,7 +293,23 @@ namespace OpenSim | |||
290 | 293 | ||
291 | m_console.Commands.AddCommand("Objects", false, "edit scale", | 294 | m_console.Commands.AddCommand("Objects", false, "edit scale", |
292 | "edit scale <name> <x> <y> <z>", | 295 | "edit scale <name> <x> <y> <z>", |
293 | "Change the scale of a named prim", HandleEditScale); | 296 | "Change the scale of a named prim", |
297 | HandleEditScale); | ||
298 | |||
299 | m_console.Commands.AddCommand("Objects", false, "rotate scene", | ||
300 | "rotate scene <degrees> [centerX, centerY]", | ||
301 | "Rotates all scene objects around centerX, centerY (defailt 128, 128) (please back up your region before using)", | ||
302 | HandleRotateScene); | ||
303 | |||
304 | m_console.Commands.AddCommand("Objects", false, "scale scene", | ||
305 | "scale scene <factor>", | ||
306 | "Scales the scene objects (please back up your region before using)", | ||
307 | HandleScaleScene); | ||
308 | |||
309 | m_console.Commands.AddCommand("Objects", false, "translate scene", | ||
310 | "translate scene xOffset yOffset zOffset", | ||
311 | "translates the scene objects (please back up your region before using)", | ||
312 | HandleTranslateScene); | ||
294 | 313 | ||
295 | m_console.Commands.AddCommand("Users", false, "kick user", | 314 | m_console.Commands.AddCommand("Users", false, "kick user", |
296 | "kick user <first> <last> [--force] [message]", | 315 | "kick user <first> <last> [--force] [message]", |
@@ -308,31 +327,38 @@ namespace OpenSim | |||
308 | 327 | ||
309 | m_console.Commands.AddCommand("Comms", false, "show connections", | 328 | m_console.Commands.AddCommand("Comms", false, "show connections", |
310 | "show connections", | 329 | "show connections", |
311 | "Show connection data", HandleShow); | 330 | "Show connection data", |
331 | HandleShow); | ||
312 | 332 | ||
313 | m_console.Commands.AddCommand("Comms", false, "show circuits", | 333 | m_console.Commands.AddCommand("Comms", false, "show circuits", |
314 | "show circuits", | 334 | "show circuits", |
315 | "Show agent circuit data", HandleShow); | 335 | "Show agent circuit data", |
336 | HandleShow); | ||
316 | 337 | ||
317 | m_console.Commands.AddCommand("Comms", false, "show pending-objects", | 338 | m_console.Commands.AddCommand("Comms", false, "show pending-objects", |
318 | "show pending-objects", | 339 | "show pending-objects", |
319 | "Show # of objects on the pending queues of all scene viewers", HandleShow); | 340 | "Show # of objects on the pending queues of all scene viewers", |
341 | HandleShow); | ||
320 | 342 | ||
321 | m_console.Commands.AddCommand("General", false, "show modules", | 343 | m_console.Commands.AddCommand("General", false, "show modules", |
322 | "show modules", | 344 | "show modules", |
323 | "Show module data", HandleShow); | 345 | "Show module data", |
346 | HandleShow); | ||
324 | 347 | ||
325 | m_console.Commands.AddCommand("Regions", false, "show regions", | 348 | m_console.Commands.AddCommand("Regions", false, "show regions", |
326 | "show regions", | 349 | "show regions", |
327 | "Show region data", HandleShow); | 350 | "Show region data", |
351 | HandleShow); | ||
328 | 352 | ||
329 | m_console.Commands.AddCommand("Regions", false, "show ratings", | 353 | m_console.Commands.AddCommand("Regions", false, "show ratings", |
330 | "show ratings", | 354 | "show ratings", |
331 | "Show rating data", HandleShow); | 355 | "Show rating data", |
356 | HandleShow); | ||
332 | 357 | ||
333 | m_console.Commands.AddCommand("Objects", false, "backup", | 358 | m_console.Commands.AddCommand("Objects", false, "backup", |
334 | "backup", | 359 | "backup", |
335 | "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); | 360 | "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", |
361 | RunCommand); | ||
336 | 362 | ||
337 | m_console.Commands.AddCommand("Regions", false, "create region", | 363 | m_console.Commands.AddCommand("Regions", false, "create region", |
338 | "create region [\"region name\"] <region_file.ini>", | 364 | "create region [\"region name\"] <region_file.ini>", |
@@ -345,34 +371,26 @@ namespace OpenSim | |||
345 | 371 | ||
346 | m_console.Commands.AddCommand("Regions", false, "restart", | 372 | m_console.Commands.AddCommand("Regions", false, "restart", |
347 | "restart", | 373 | "restart", |
348 | "Restart all sims in this instance", RunCommand); | 374 | "Restart all sims in this instance", |
375 | RunCommand); | ||
349 | 376 | ||
350 | m_console.Commands.AddCommand("General", false, "command-script", | 377 | m_console.Commands.AddCommand("General", false, "command-script", |
351 | "command-script <script>", | 378 | "command-script <script>", |
352 | "Run a command script from file", RunCommand); | 379 | "Run a command script from file", |
380 | RunCommand); | ||
353 | 381 | ||
354 | m_console.Commands.AddCommand("Regions", false, "remove-region", | 382 | m_console.Commands.AddCommand("Regions", false, "remove-region", |
355 | "remove-region <name>", | 383 | "remove-region <name>", |
356 | "Remove a region from this simulator", RunCommand); | 384 | "Remove a region from this simulator", |
385 | RunCommand); | ||
357 | 386 | ||
358 | m_console.Commands.AddCommand("Regions", false, "delete-region", | 387 | m_console.Commands.AddCommand("Regions", false, "delete-region", |
359 | "delete-region <name>", | 388 | "delete-region <name>", |
360 | "Delete a region from disk", RunCommand); | 389 | "Delete a region from disk", |
361 | 390 | RunCommand); | |
362 | m_console.Commands.AddCommand("General", false, "modules list", | ||
363 | "modules list", | ||
364 | "List modules", HandleModules); | ||
365 | |||
366 | m_console.Commands.AddCommand("General", false, "modules load", | ||
367 | "modules load <name>", | ||
368 | "Load a module", HandleModules); | ||
369 | |||
370 | m_console.Commands.AddCommand("General", false, "modules unload", | ||
371 | "modules unload <name>", | ||
372 | "Unload a module", HandleModules); | ||
373 | } | 391 | } |
374 | 392 | ||
375 | public override void ShutdownSpecific() | 393 | protected override void ShutdownSpecific() |
376 | { | 394 | { |
377 | if (m_shutdownCommandsFile != String.Empty) | 395 | if (m_shutdownCommandsFile != String.Empty) |
378 | { | 396 | { |
@@ -435,8 +453,8 @@ namespace OpenSim | |||
435 | { | 453 | { |
436 | RegionInfo regionInfo = presence.Scene.RegionInfo; | 454 | RegionInfo regionInfo = presence.Scene.RegionInfo; |
437 | 455 | ||
438 | if (presence.Firstname.ToLower().Contains(mainParams[2].ToLower()) && | 456 | if (presence.Firstname.ToLower().Equals(mainParams[2].ToLower()) && |
439 | presence.Lastname.ToLower().Contains(mainParams[3].ToLower())) | 457 | presence.Lastname.ToLower().Equals(mainParams[3].ToLower())) |
440 | { | 458 | { |
441 | MainConsole.Instance.Output( | 459 | MainConsole.Instance.Output( |
442 | String.Format( | 460 | String.Format( |
@@ -449,7 +467,8 @@ namespace OpenSim | |||
449 | else | 467 | else |
450 | presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n"); | 468 | presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n"); |
451 | 469 | ||
452 | presence.Scene.IncomingCloseAgent(presence.UUID, force); | 470 | presence.Scene.CloseAgent(presence.UUID, force); |
471 | break; | ||
453 | } | 472 | } |
454 | } | 473 | } |
455 | 474 | ||
@@ -501,6 +520,121 @@ namespace OpenSim | |||
501 | } | 520 | } |
502 | } | 521 | } |
503 | 522 | ||
523 | private void HandleRotateScene(string module, string[] args) | ||
524 | { | ||
525 | string usage = "Usage: rotate scene <angle in degrees> [centerX centerY] (centerX and centerY are optional and default to Constants.RegionSize / 2"; | ||
526 | |||
527 | float centerX = Constants.RegionSize * 0.5f; | ||
528 | float centerY = Constants.RegionSize * 0.5f; | ||
529 | |||
530 | if (args.Length < 3 || args.Length == 4) | ||
531 | { | ||
532 | MainConsole.Instance.Output(usage); | ||
533 | return; | ||
534 | } | ||
535 | |||
536 | float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI); | ||
537 | OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); | ||
538 | |||
539 | if (args.Length > 4) | ||
540 | { | ||
541 | centerX = Convert.ToSingle(args[3]); | ||
542 | centerY = Convert.ToSingle(args[4]); | ||
543 | } | ||
544 | |||
545 | Vector3 center = new Vector3(centerX, centerY, 0.0f); | ||
546 | |||
547 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
548 | { | ||
549 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
550 | { | ||
551 | if (sog.AttachmentPoint == 0) | ||
552 | { | ||
553 | sog.RootPart.UpdateRotation(rot * sog.GroupRotation); | ||
554 | Vector3 offset = sog.AbsolutePosition - center; | ||
555 | offset *= rot; | ||
556 | sog.UpdateGroupPosition(center + offset); | ||
557 | } | ||
558 | }); | ||
559 | }); | ||
560 | } | ||
561 | |||
562 | private void HandleScaleScene(string module, string[] args) | ||
563 | { | ||
564 | string usage = "Usage: scale scene <factor>"; | ||
565 | |||
566 | if (args.Length < 3) | ||
567 | { | ||
568 | MainConsole.Instance.Output(usage); | ||
569 | return; | ||
570 | } | ||
571 | |||
572 | float factor = (float)(Convert.ToSingle(args[2])); | ||
573 | |||
574 | float minZ = float.MaxValue; | ||
575 | |||
576 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
577 | { | ||
578 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
579 | { | ||
580 | if (sog.AttachmentPoint == 0) | ||
581 | { | ||
582 | if (sog.RootPart.AbsolutePosition.Z < minZ) | ||
583 | minZ = sog.RootPart.AbsolutePosition.Z; | ||
584 | } | ||
585 | }); | ||
586 | }); | ||
587 | |||
588 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
589 | { | ||
590 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
591 | { | ||
592 | if (sog.AttachmentPoint == 0) | ||
593 | { | ||
594 | Vector3 tmpRootPos = sog.RootPart.AbsolutePosition; | ||
595 | tmpRootPos.Z -= minZ; | ||
596 | tmpRootPos *= factor; | ||
597 | tmpRootPos.Z += minZ; | ||
598 | |||
599 | foreach (SceneObjectPart sop in sog.Parts) | ||
600 | { | ||
601 | if (sop.ParentID != 0) | ||
602 | sop.OffsetPosition *= factor; | ||
603 | sop.Scale *= factor; | ||
604 | } | ||
605 | |||
606 | sog.UpdateGroupPosition(tmpRootPos); | ||
607 | } | ||
608 | }); | ||
609 | }); | ||
610 | } | ||
611 | |||
612 | private void HandleTranslateScene(string module, string[] args) | ||
613 | { | ||
614 | string usage = "Usage: translate scene <xOffset, yOffset, zOffset>"; | ||
615 | |||
616 | if (args.Length < 5) | ||
617 | { | ||
618 | MainConsole.Instance.Output(usage); | ||
619 | return; | ||
620 | } | ||
621 | |||
622 | float xOFfset = (float)Convert.ToSingle(args[2]); | ||
623 | float yOffset = (float)Convert.ToSingle(args[3]); | ||
624 | float zOffset = (float)Convert.ToSingle(args[4]); | ||
625 | |||
626 | Vector3 offset = new Vector3(xOFfset, yOffset, zOffset); | ||
627 | |||
628 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
629 | { | ||
630 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
631 | { | ||
632 | if (sog.AttachmentPoint == 0) | ||
633 | sog.UpdateGroupPosition(sog.AbsolutePosition + offset); | ||
634 | }); | ||
635 | }); | ||
636 | } | ||
637 | |||
504 | /// <summary> | 638 | /// <summary> |
505 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console | 639 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console |
506 | /// </summary> | 640 | /// </summary> |
@@ -566,34 +700,6 @@ namespace OpenSim | |||
566 | } | 700 | } |
567 | 701 | ||
568 | /// <summary> | 702 | /// <summary> |
569 | /// Load, Unload, and list Region modules in use | ||
570 | /// </summary> | ||
571 | /// <param name="module"></param> | ||
572 | /// <param name="cmd"></param> | ||
573 | private void HandleModules(string module, string[] cmd) | ||
574 | { | ||
575 | List<string> args = new List<string>(cmd); | ||
576 | args.RemoveAt(0); | ||
577 | string[] cmdparams = args.ToArray(); | ||
578 | |||
579 | if (cmdparams.Length > 0) | ||
580 | { | ||
581 | switch (cmdparams[0].ToLower()) | ||
582 | { | ||
583 | case "list": | ||
584 | //TODO: Convert to new region modules | ||
585 | break; | ||
586 | case "unload": | ||
587 | //TODO: Convert to new region modules | ||
588 | break; | ||
589 | case "load": | ||
590 | //TODO: Convert to new region modules | ||
591 | break; | ||
592 | } | ||
593 | } | ||
594 | } | ||
595 | |||
596 | /// <summary> | ||
597 | /// Runs commands issued by the server console from the operator | 703 | /// Runs commands issued by the server console from the operator |
598 | /// </summary> | 704 | /// </summary> |
599 | /// <param name="command">The first argument of the parameter (the command)</param> | 705 | /// <param name="command">The first argument of the parameter (the command)</param> |
@@ -701,45 +807,6 @@ namespace OpenSim | |||
701 | RefreshPrompt(); | 807 | RefreshPrompt(); |
702 | } | 808 | } |
703 | 809 | ||
704 | /// <summary> | ||
705 | /// Turn on some debugging values for OpenSim. | ||
706 | /// </summary> | ||
707 | /// <param name="args"></param> | ||
708 | protected void Debug(string module, string[] args) | ||
709 | { | ||
710 | if (args.Length == 1) | ||
711 | return; | ||
712 | |||
713 | switch (args[1]) | ||
714 | { | ||
715 | case "packet": | ||
716 | string name = null; | ||
717 | if (args.Length == 5) | ||
718 | name = string.Format("{0} {1}", args[3], args[4]); | ||
719 | |||
720 | if (args.Length > 2) | ||
721 | { | ||
722 | int newDebug; | ||
723 | if (int.TryParse(args[2], out newDebug)) | ||
724 | { | ||
725 | SceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); | ||
726 | // We provide user information elsewhere if any clients had their debug level set. | ||
727 | // MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug); | ||
728 | } | ||
729 | else | ||
730 | { | ||
731 | MainConsole.Instance.Output("Usage: debug packet 0..255"); | ||
732 | } | ||
733 | } | ||
734 | |||
735 | break; | ||
736 | |||
737 | default: | ||
738 | MainConsole.Instance.Output("Unknown debug command"); | ||
739 | break; | ||
740 | } | ||
741 | } | ||
742 | |||
743 | // see BaseOpenSimServer | 810 | // see BaseOpenSimServer |
744 | /// <summary> | 811 | /// <summary> |
745 | /// Many commands list objects for debugging. Some of the types are listed here | 812 | /// Many commands list objects for debugging. Some of the types are listed here |
@@ -829,7 +896,7 @@ namespace OpenSim | |||
829 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | 896 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) |
830 | MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name); | 897 | MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name); |
831 | 898 | ||
832 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | 899 | foreach (IRegionModuleBase module in nonSharedModules.OrderBy(m => m.Name)) |
833 | MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name); | 900 | MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name); |
834 | } | 901 | } |
835 | ); | 902 | ); |
@@ -911,15 +978,25 @@ namespace OpenSim | |||
911 | cdt.AddColumn("Circuit code", 12); | 978 | cdt.AddColumn("Circuit code", 12); |
912 | cdt.AddColumn("Endpoint", 23); | 979 | cdt.AddColumn("Endpoint", 23); |
913 | cdt.AddColumn("Active?", 7); | 980 | cdt.AddColumn("Active?", 7); |
981 | cdt.AddColumn("ChildAgent?", 7); | ||
982 | cdt.AddColumn("ping(ms)", 8); | ||
914 | 983 | ||
915 | SceneManager.ForEachScene( | 984 | SceneManager.ForEachScene( |
916 | s => s.ForEachClient( | 985 | s => s.ForEachClient( |
917 | c => cdt.AddRow( | 986 | c => |
918 | s.Name, | 987 | { |
919 | c.Name, | 988 | bool child = false; |
920 | c.CircuitCode.ToString(), | 989 | if(c.SceneAgent != null && c.SceneAgent.IsChildAgent) |
921 | c.RemoteEndPoint.ToString(), | 990 | child = true; |
922 | c.IsActive.ToString()))); | 991 | cdt.AddRow( |
992 | s.Name, | ||
993 | c.Name, | ||
994 | c.CircuitCode.ToString(), | ||
995 | c.RemoteEndPoint.ToString(), | ||
996 | c.IsActive.ToString(), | ||
997 | child.ToString(), | ||
998 | c.PingTimeMS); | ||
999 | })); | ||
923 | 1000 | ||
924 | MainConsole.Instance.Output(cdt.ToString()); | 1001 | MainConsole.Instance.Output(cdt.ToString()); |
925 | } | 1002 | } |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 88bd869..f663c77 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim | |||
75 | protected int proxyOffset = 0; | 75 | protected int proxyOffset = 0; |
76 | 76 | ||
77 | public string userStatsURI = String.Empty; | 77 | public string userStatsURI = String.Empty; |
78 | public string managedStatsURI = String.Empty; | ||
78 | 79 | ||
79 | protected bool m_autoCreateClientStack = true; | 80 | protected bool m_autoCreateClientStack = true; |
80 | 81 | ||
@@ -199,6 +200,8 @@ namespace OpenSim | |||
199 | new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); | 200 | new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); |
200 | 201 | ||
201 | m_permsModules = new List<string>(permissionModules.Split(',')); | 202 | m_permsModules = new List<string>(permissionModules.Split(',')); |
203 | |||
204 | managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty); | ||
202 | } | 205 | } |
203 | 206 | ||
204 | // Load the simulation data service | 207 | // Load the simulation data service |
@@ -248,10 +251,7 @@ namespace OpenSim | |||
248 | } | 251 | } |
249 | 252 | ||
250 | if (m_console != null) | 253 | if (m_console != null) |
251 | { | ||
252 | StatsManager.RegisterConsoleCommands(m_console); | ||
253 | AddPluginCommands(m_console); | 254 | AddPluginCommands(m_console); |
254 | } | ||
255 | } | 255 | } |
256 | 256 | ||
257 | protected virtual void AddPluginCommands(ICommandConsole console) | 257 | protected virtual void AddPluginCommands(ICommandConsole console) |
@@ -496,9 +496,6 @@ namespace OpenSim | |||
496 | scene.SnmpService.LinkUp(scene); | 496 | scene.SnmpService.LinkUp(scene); |
497 | } | 497 | } |
498 | 498 | ||
499 | scene.Start(); | ||
500 | scene.StartScripts(); | ||
501 | |||
502 | return clientServers; | 499 | return clientServers; |
503 | } | 500 | } |
504 | 501 | ||
@@ -813,7 +810,7 @@ namespace OpenSim | |||
813 | 810 | ||
814 | if (foundClientServer) | 811 | if (foundClientServer) |
815 | { | 812 | { |
816 | m_clientServers[clientServerElement].NetworkStop(); | 813 | m_clientServers[clientServerElement].Stop(); |
817 | m_clientServers.RemoveAt(clientServerElement); | 814 | m_clientServers.RemoveAt(clientServerElement); |
818 | } | 815 | } |
819 | } | 816 | } |
@@ -827,6 +824,7 @@ namespace OpenSim | |||
827 | ShutdownClientServer(whichRegion); | 824 | ShutdownClientServer(whichRegion); |
828 | IScene scene; | 825 | IScene scene; |
829 | CreateRegion(whichRegion, true, out scene); | 826 | CreateRegion(whichRegion, true, out scene); |
827 | scene.Start(); | ||
830 | } | 828 | } |
831 | 829 | ||
832 | # region Setup methods | 830 | # region Setup methods |
@@ -840,73 +838,49 @@ namespace OpenSim | |||
840 | /// <summary> | 838 | /// <summary> |
841 | /// Handler to supply the current status of this sim | 839 | /// Handler to supply the current status of this sim |
842 | /// </summary> | 840 | /// </summary> |
841 | /// <remarks> | ||
843 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service | 842 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service |
844 | public class SimStatusHandler : IStreamedRequestHandler | 843 | /// </remarks> |
844 | public class SimStatusHandler : BaseStreamHandler | ||
845 | { | 845 | { |
846 | public byte[] Handle(string path, Stream request, | 846 | public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {} |
847 | |||
848 | protected override byte[] ProcessRequest(string path, Stream request, | ||
847 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 849 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
848 | { | 850 | { |
849 | return Util.UTF8.GetBytes("OK"); | 851 | return Util.UTF8.GetBytes("OK"); |
850 | } | 852 | } |
851 | 853 | ||
852 | public string Name { get { return "SimStatus"; } } | 854 | public override string ContentType |
853 | public string Description { get { return "Simulator Status"; } } | ||
854 | |||
855 | public string ContentType | ||
856 | { | 855 | { |
857 | get { return "text/plain"; } | 856 | get { return "text/plain"; } |
858 | } | 857 | } |
859 | |||
860 | public string HttpMethod | ||
861 | { | ||
862 | get { return "GET"; } | ||
863 | } | ||
864 | |||
865 | public string Path | ||
866 | { | ||
867 | get { return "/simstatus"; } | ||
868 | } | ||
869 | } | 858 | } |
870 | 859 | ||
871 | /// <summary> | 860 | /// <summary> |
872 | /// Handler to supply the current extended status of this sim | 861 | /// Handler to supply the current extended status of this sim |
873 | /// Sends the statistical data in a json serialization | 862 | /// Sends the statistical data in a json serialization |
874 | /// </summary> | 863 | /// </summary> |
875 | public class XSimStatusHandler : IStreamedRequestHandler | 864 | public class XSimStatusHandler : BaseStreamHandler |
876 | { | 865 | { |
877 | OpenSimBase m_opensim; | 866 | OpenSimBase m_opensim; |
878 | string osXStatsURI = String.Empty; | ||
879 | |||
880 | public string Name { get { return "XSimStatus"; } } | ||
881 | public string Description { get { return "Simulator XStatus"; } } | ||
882 | 867 | ||
883 | public XSimStatusHandler(OpenSimBase sim) | 868 | public XSimStatusHandler(OpenSimBase sim) |
869 | : base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus") | ||
884 | { | 870 | { |
885 | m_opensim = sim; | 871 | m_opensim = sim; |
886 | osXStatsURI = Util.SHA1Hash(sim.osSecret); | ||
887 | } | 872 | } |
888 | 873 | ||
889 | public byte[] Handle(string path, Stream request, | 874 | protected override byte[] ProcessRequest(string path, Stream request, |
890 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 875 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
891 | { | 876 | { |
892 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); | 877 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); |
893 | } | 878 | } |
894 | 879 | ||
895 | public string ContentType | 880 | public override string ContentType |
896 | { | 881 | { |
897 | get { return "text/plain"; } | 882 | get { return "text/plain"; } |
898 | } | 883 | } |
899 | |||
900 | public string HttpMethod | ||
901 | { | ||
902 | get { return "GET"; } | ||
903 | } | ||
904 | |||
905 | public string Path | ||
906 | { | ||
907 | // This is for the OpenSimulator instance and is the osSecret hashed | ||
908 | get { return "/" + osXStatsURI; } | ||
909 | } | ||
910 | } | 884 | } |
911 | 885 | ||
912 | /// <summary> | 886 | /// <summary> |
@@ -915,42 +889,26 @@ namespace OpenSim | |||
915 | /// If the request contains a key, "callback" the response will be wrappend in the | 889 | /// If the request contains a key, "callback" the response will be wrappend in the |
916 | /// associated value for jsonp used with ajax/javascript | 890 | /// associated value for jsonp used with ajax/javascript |
917 | /// </summary> | 891 | /// </summary> |
918 | public class UXSimStatusHandler : IStreamedRequestHandler | 892 | protected class UXSimStatusHandler : BaseStreamHandler |
919 | { | 893 | { |
920 | OpenSimBase m_opensim; | 894 | OpenSimBase m_opensim; |
921 | string osUXStatsURI = String.Empty; | ||
922 | |||
923 | public string Name { get { return "UXSimStatus"; } } | ||
924 | public string Description { get { return "Simulator UXStatus"; } } | ||
925 | 895 | ||
926 | public UXSimStatusHandler(OpenSimBase sim) | 896 | public UXSimStatusHandler(OpenSimBase sim) |
897 | : base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus") | ||
927 | { | 898 | { |
928 | m_opensim = sim; | 899 | m_opensim = sim; |
929 | osUXStatsURI = sim.userStatsURI; | ||
930 | |||
931 | } | 900 | } |
932 | 901 | ||
933 | public byte[] Handle(string path, Stream request, | 902 | protected override byte[] ProcessRequest(string path, Stream request, |
934 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 903 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
935 | { | 904 | { |
936 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); | 905 | return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); |
937 | } | 906 | } |
938 | 907 | ||
939 | public string ContentType | 908 | public override string ContentType |
940 | { | 909 | { |
941 | get { return "text/plain"; } | 910 | get { return "text/plain"; } |
942 | } | 911 | } |
943 | |||
944 | public string HttpMethod | ||
945 | { | ||
946 | get { return "GET"; } | ||
947 | } | ||
948 | |||
949 | public string Path | ||
950 | { | ||
951 | // This is for the OpenSimulator instance and is the user provided URI | ||
952 | get { return "/" + osUXStatsURI; } | ||
953 | } | ||
954 | } | 912 | } |
955 | 913 | ||
956 | #endregion | 914 | #endregion |
@@ -958,7 +916,7 @@ namespace OpenSim | |||
958 | /// <summary> | 916 | /// <summary> |
959 | /// Performs any last-minute sanity checking and shuts down the region server | 917 | /// Performs any last-minute sanity checking and shuts down the region server |
960 | /// </summary> | 918 | /// </summary> |
961 | public override void ShutdownSpecific() | 919 | protected override void ShutdownSpecific() |
962 | { | 920 | { |
963 | if (proxyUrl.Length > 0) | 921 | if (proxyUrl.Length > 0) |
964 | { | 922 | { |
@@ -978,6 +936,8 @@ namespace OpenSim | |||
978 | { | 936 | { |
979 | m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); | 937 | m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); |
980 | } | 938 | } |
939 | |||
940 | base.ShutdownSpecific(); | ||
981 | } | 941 | } |
982 | 942 | ||
983 | /// <summary> | 943 | /// <summary> |
@@ -1025,7 +985,7 @@ namespace OpenSim | |||
1025 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); | 985 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); |
1026 | 986 | ||
1027 | string newName; | 987 | string newName; |
1028 | if (estateName != null && estateName != "") | 988 | if (!string.IsNullOrEmpty(estateName)) |
1029 | newName = estateName; | 989 | newName = estateName; |
1030 | else | 990 | else |
1031 | newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); | 991 | newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); |