aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/Application.cs69
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs21
-rw-r--r--OpenSim/Region/Application/IApplicationPlugin.cs2
-rw-r--r--OpenSim/Region/Application/OpenSim.cs197
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs185
-rw-r--r--OpenSim/Region/Application/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Region/Application/RegionApplicationBase.cs38
7 files changed, 354 insertions, 168 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index bf34419..66ce8e5 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -74,7 +74,16 @@ namespace OpenSim
74 AppDomain.CurrentDomain.UnhandledException += 74 AppDomain.CurrentDomain.UnhandledException +=
75 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 75 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
76 76
77 ServicePointManager.DefaultConnectionLimit = 12; 77 if(Util.IsWindows())
78 ServicePointManager.DefaultConnectionLimit = 32;
79 else
80 {
81 ServicePointManager.DefaultConnectionLimit = 12;
82 }
83
84 try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
85 ServicePointManager.Expect100Continue = false;
86 ServicePointManager.UseNagleAlgorithm = false;
78 87
79 // Add the arguments supplied when running the application to the configuration 88 // Add the arguments supplied when running the application to the configuration
80 ArgvConfigSource configSource = new ArgvConfigSource(args); 89 ArgvConfigSource configSource = new ArgvConfigSource(args);
@@ -85,9 +94,9 @@ namespace OpenSim
85 if (logConfigFile != String.Empty) 94 if (logConfigFile != String.Empty)
86 { 95 {
87 XmlConfigurator.Configure(new System.IO.FileInfo(logConfigFile)); 96 XmlConfigurator.Configure(new System.IO.FileInfo(logConfigFile));
88 m_log.InfoFormat("[OPENSIM MAIN]: configured log4net using \"{0}\" as configuration file", 97 m_log.InfoFormat("[OPENSIM MAIN]: configured log4net using \"{0}\" as configuration file",
89 logConfigFile); 98 logConfigFile);
90 } 99 }
91 else 100 else
92 { 101 {
93 XmlConfigurator.Configure(); 102 XmlConfigurator.Configure();
@@ -103,22 +112,22 @@ namespace OpenSim
103 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); 112 "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
104 113
105 // Verify the Threadpool allocates or uses enough worker and IO completion threads 114 // Verify the Threadpool allocates or uses enough worker and IO completion threads
106 // .NET 2.0, workerthreads default to 50 * numcores 115 // .NET 2.0, workerthreads default to 50 * numcores
107 // .NET 3.0, workerthreads defaults to 250 * numcores 116 // .NET 3.0, workerthreads defaults to 250 * numcores
108 // .NET 4.0, workerthreads are dynamic based on bitness and OS resources 117 // .NET 4.0, workerthreads are dynamic based on bitness and OS resources
109 // Max IO Completion threads are 1000 on all 3 CLRs 118 // Max IO Completion threads are 1000 on all 3 CLRs
110 // 119 //
111 // Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores 120 // Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores
112 int workerThreadsMin = 500; 121 int workerThreadsMin = 500;
113 int workerThreadsMax = 1000; // may need further adjustment to match other CLR 122 int workerThreadsMax = 1000; // may need further adjustment to match other CLR
114 int iocpThreadsMin = 1000; 123 int iocpThreadsMin = 1000;
115 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR 124 int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
116 125
117 { 126 {
118 int currentMinWorkerThreads, currentMinIocpThreads; 127 int currentMinWorkerThreads, currentMinIocpThreads;
119 System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads); 128 System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads);
120 m_log.InfoFormat( 129 m_log.InfoFormat(
121 "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads", 130 "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads",
122 currentMinWorkerThreads, currentMinIocpThreads); 131 currentMinWorkerThreads, currentMinIocpThreads);
123 } 132 }
124 133
@@ -137,30 +146,30 @@ namespace OpenSim
137 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads); 146 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads);
138 } 147 }
139 148
140 // Increase the number of IOCP threads available. 149 // Increase the number of IOCP threads available.
141 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) 150 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
142 if (iocpThreads < iocpThreadsMin) 151 if (iocpThreads < iocpThreadsMin)
143 { 152 {
144 iocpThreads = iocpThreadsMin; 153 iocpThreads = iocpThreadsMin;
145 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads); 154 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads);
146 } 155 }
147 // Make sure we don't overallocate IOCP threads and thrash system resources 156 // Make sure we don't overallocate IOCP threads and thrash system resources
148 if ( iocpThreads > iocpThreadsMax ) 157 if ( iocpThreads > iocpThreadsMax )
149 { 158 {
150 iocpThreads = iocpThreadsMax; 159 iocpThreads = iocpThreadsMax;
151 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads); 160 m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads);
152 } 161 }
153 // set the resulting worker and IO completion thread counts back to ThreadPool 162 // set the resulting worker and IO completion thread counts back to ThreadPool
154 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) ) 163 if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
155 { 164 {
156 m_log.InfoFormat( 165 m_log.InfoFormat(
157 "[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads", 166 "[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads",
158 workerThreads, iocpThreads); 167 workerThreads, iocpThreads);
159 } 168 }
160 else 169 else
161 { 170 {
162 m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect."); 171 m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
163 } 172 }
164 173
165 // Check if the system is compatible with OpenSimulator. 174 // Check if the system is compatible with OpenSimulator.
166 // Ensures that the minimum system requirements are met 175 // Ensures that the minimum system requirements are met
@@ -178,7 +187,7 @@ namespace OpenSim
178 Culture.SetCurrentCulture(); 187 Culture.SetCurrentCulture();
179 188
180 // Validate that the user has the most basic configuration done 189 // Validate that the user has the most basic configuration done
181 // If not, offer to do the most basic configuration for them warning them along the way of the importance of 190 // If not, offer to do the most basic configuration for them warning them along the way of the importance of
182 // reading these files. 191 // reading these files.
183 /* 192 /*
184 m_log.Info("Checking for reguired configuration...\n"); 193 m_log.Info("Checking for reguired configuration...\n");
@@ -187,13 +196,13 @@ namespace OpenSim
187 || (File.Exists(Path.Combine(Util.configDir(), "opensim.ini"))) 196 || (File.Exists(Path.Combine(Util.configDir(), "opensim.ini")))
188 || (File.Exists(Path.Combine(Util.configDir(), "openSim.ini"))) 197 || (File.Exists(Path.Combine(Util.configDir(), "openSim.ini")))
189 || (File.Exists(Path.Combine(Util.configDir(), "Opensim.ini"))); 198 || (File.Exists(Path.Combine(Util.configDir(), "Opensim.ini")));
190 199
191 bool StanaloneCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini")); 200 bool StanaloneCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini"));
192 bool StanaloneCommon_lowercased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "standalonecommon.ini")); 201 bool StanaloneCommon_lowercased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "standalonecommon.ini"));
193 bool GridCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "GridCommon.ini")); 202 bool GridCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "GridCommon.ini"));
194 bool GridCommon_lowerCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "gridcommon.ini")); 203 bool GridCommon_lowerCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "gridcommon.ini"));
195 204
196 if ((OpenSim_Ini) 205 if ((OpenSim_Ini)
197 && ( 206 && (
198 (StanaloneCommon_ProperCased 207 (StanaloneCommon_ProperCased
199 || StanaloneCommon_lowercased 208 || StanaloneCommon_lowercased
@@ -211,7 +220,7 @@ namespace OpenSim
211 "yes"); 220 "yes");
212 if (resp == "yes") 221 if (resp == "yes")
213 { 222 {
214 223
215 if (!(OpenSim_Ini)) 224 if (!(OpenSim_Ini))
216 { 225 {
217 try 226 try
@@ -311,7 +320,7 @@ namespace OpenSim
311 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); 320 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
312 321
313 // load Crash directory config 322 // load Crash directory config
314 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); 323 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
315 324
316 if (background) 325 if (background)
317 { 326 {
@@ -319,9 +328,9 @@ namespace OpenSim
319 m_sim.Startup(); 328 m_sim.Startup();
320 } 329 }
321 else 330 else
322 { 331 {
323 m_sim = new OpenSim(configSource); 332 m_sim = new OpenSim(configSource);
324 333
325 m_sim.Startup(); 334 m_sim.Startup();
326 335
327 while (true) 336 while (true)
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index cf7db97..19db7a9 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -43,10 +43,10 @@ namespace OpenSim
43 public class ConfigurationLoader 43 public class ConfigurationLoader
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 /// <summary> 47 /// <summary>
48 /// Various Config settings the region needs to start 48 /// Various Config settings the region needs to start
49 /// Physics Engine, Mesh Engine, GridMode, PhysicsPrim allowed, Neighbor, 49 /// Physics Engine, Mesh Engine, GridMode, PhysicsPrim allowed, Neighbor,
50 /// StorageDLL, Storage Connection String, Estate connection String, Client Stack 50 /// StorageDLL, Storage Connection String, Estate connection String, Client Stack
51 /// Standalone settings. 51 /// Standalone settings.
52 /// </summary> 52 /// </summary>
@@ -154,7 +154,7 @@ namespace OpenSim
154 } 154 }
155 155
156 // Override distro settings with contents of inidirectory 156 // Override distro settings with contents of inidirectory
157 string iniDirPath = Path.GetFullPath(Path.Combine(Util.configDir(), startupConfig.GetString("inidirectory", "config"))); 157 string iniDirPath = startupConfig.GetString("inidirectory", Util.configDir());
158 158
159 if (Directory.Exists(iniDirPath)) 159 if (Directory.Exists(iniDirPath))
160 { 160 {
@@ -187,7 +187,7 @@ namespace OpenSim
187 { 187 {
188 iniFileExists = true; 188 iniFileExists = true;
189 AddIncludes(overrideConfig, overrideSources); 189 AddIncludes(overrideConfig, overrideSources);
190 } 190 }
191 } 191 }
192 m_config.Source.Merge(overrideConfig.Source); 192 m_config.Source.Merge(overrideConfig.Source);
193 } 193 }
@@ -197,7 +197,7 @@ namespace OpenSim
197 { 197 {
198 m_log.FatalFormat("[CONFIG]: Could not load any configuration"); 198 m_log.FatalFormat("[CONFIG]: Could not load any configuration");
199 Environment.Exit(1); 199 Environment.Exit(1);
200 } 200 }
201 else if (!iniFileExists) 201 else if (!iniFileExists)
202 { 202 {
203 m_log.FatalFormat("[CONFIG]: Could not load any configuration"); 203 m_log.FatalFormat("[CONFIG]: Could not load any configuration");
@@ -256,14 +256,14 @@ namespace OpenSim
256 string path = Path.Combine(basepath, chunkWithoutWildcards); 256 string path = Path.Combine(basepath, chunkWithoutWildcards);
257 path = Path.GetFullPath(path) + chunkWithWildcards; 257 path = Path.GetFullPath(path) + chunkWithWildcards;
258 string[] paths = Util.Glob(path); 258 string[] paths = Util.Glob(path);
259 259
260 // If the include path contains no wildcards, then warn the user that it wasn't found. 260 // If the include path contains no wildcards, then warn the user that it wasn't found.
261 if (wildcardIndex == -1 && paths.Length == 0) 261 if (wildcardIndex == -1 && paths.Length == 0)
262 { 262 {
263 m_log.WarnFormat("[CONFIG]: Could not find include file {0}", path); 263 m_log.WarnFormat("[CONFIG]: Could not find include file {0}", path);
264 } 264 }
265 else 265 else
266 { 266 {
267 foreach (string p in paths) 267 foreach (string p in paths)
268 { 268 {
269 if (!sources.Contains(p)) 269 if (!sources.Contains(p))
@@ -347,13 +347,10 @@ namespace OpenSim
347 config.Set("meshing", "Meshmerizer"); 347 config.Set("meshing", "Meshmerizer");
348 config.Set("physical_prim", true); 348 config.Set("physical_prim", true);
349 config.Set("serverside_object_permissions", true); 349 config.Set("serverside_object_permissions", true);
350 config.Set("storage_prim_inventories", true);
351 config.Set("startup_console_commands_file", String.Empty); 350 config.Set("startup_console_commands_file", String.Empty);
352 config.Set("shutdown_console_commands_file", String.Empty); 351 config.Set("shutdown_console_commands_file", String.Empty);
353 config.Set("DefaultScriptEngine", "XEngine"); 352 config.Set("DefaultScriptEngine", "XEngine");
354 config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); 353 config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
355 // life doesn't really work without this
356 config.Set("EventQueue", true);
357 } 354 }
358 355
359 { 356 {
@@ -379,11 +376,11 @@ namespace OpenSim
379 m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); 376 m_configSettings.PhysicsEngine = startupConfig.GetString("physics");
380 m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); 377 m_configSettings.MeshEngineName = startupConfig.GetString("meshing");
381 378
382 m_configSettings.ClientstackDll 379 m_configSettings.ClientstackDll
383 = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); 380 = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
384 } 381 }
385 382
386 m_networkServersInfo.loadFromConfiguration(m_config.Source); 383 m_networkServersInfo.loadFromConfiguration(m_config.Source);
387 } 384 }
388 } 385 }
389} \ No newline at end of file 386}
diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs
index a3fa66c..ff3f5d7 100644
--- a/OpenSim/Region/Application/IApplicationPlugin.cs
+++ b/OpenSim/Region/Application/IApplicationPlugin.cs
@@ -43,7 +43,7 @@ namespace OpenSim
43 void Initialise(OpenSimBase openSim); 43 void Initialise(OpenSimBase openSim);
44 44
45 /// <summary> 45 /// <summary>
46 /// Called when the application loading is completed 46 /// Called when the application loading is completed
47 /// </summary> 47 /// </summary>
48 void PostInitialise(); 48 void PostInitialise();
49 } 49 }
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 5af8194..fcc8717 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -26,12 +26,14 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
29using System.Collections; 30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Diagnostics; 32using System.Diagnostics;
32using System.IO; 33using System.IO;
33using System.Linq; 34using System.Linq;
34using System.Reflection; 35using System.Reflection;
36using System.Runtime;
35using System.Text; 37using System.Text;
36using System.Text.RegularExpressions; 38using System.Text.RegularExpressions;
37using System.Timers; 39using System.Timers;
@@ -74,7 +76,7 @@ namespace OpenSim
74 76
75 private string m_timedScript = "disabled"; 77 private string m_timedScript = "disabled";
76 private int m_timeInterval = 1200; 78 private int m_timeInterval = 1200;
77 private Timer m_scriptTimer; 79 private System.Timers.Timer m_scriptTimer;
78 80
79 public OpenSim(IConfigSource configSource) : base(configSource) 81 public OpenSim(IConfigSource configSource) : base(configSource)
80 { 82 {
@@ -114,8 +116,8 @@ namespace OpenSim
114 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) 116 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
115 Util.FireAndForgetMethod = asyncCallMethod; 117 Util.FireAndForgetMethod = asyncCallMethod;
116 118
117 stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15); 119 stpMinThreads = startupConfig.GetInt("MinPoolThreads", 2 );
118 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 300); 120 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 25);
119 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); 121 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) ");
120 } 122 }
121 123
@@ -123,8 +125,27 @@ namespace OpenSim
123 Util.InitThreadPool(stpMinThreads, stpMaxThreads); 125 Util.InitThreadPool(stpMinThreads, stpMaxThreads);
124 126
125 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); 127 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
128
129 m_log.InfoFormat("[OPENSIM MAIN] Running GC in {0} mode", GCSettings.IsServerGC ? "server":"workstation");
126 } 130 }
127 131
132#if (_MONO)
133 private static Mono.Unix.UnixSignal[] signals;
134
135
136 private Thread signal_thread = new Thread (delegate ()
137 {
138 while (true)
139 {
140 // Wait for a signal to be delivered
141 int index = Mono.Unix.UnixSignal.WaitAny (signals, -1);
142
143 //Mono.Unix.Native.Signum signal = signals [index].Signum;
144 MainConsole.Instance.RunCommand("shutdown");
145 }
146 });
147#endif
148
128 /// <summary> 149 /// <summary>
129 /// Performs initialisation of the scene, such as loading configuration from disk. 150 /// Performs initialisation of the scene, such as loading configuration from disk.
130 /// </summary> 151 /// </summary>
@@ -134,6 +155,27 @@ namespace OpenSim
134 m_log.Info("========================= STARTING OPENSIM ========================="); 155 m_log.Info("========================= STARTING OPENSIM =========================");
135 m_log.Info("===================================================================="); 156 m_log.Info("====================================================================");
136 157
158#if (_MONO)
159 if(!Util.IsWindows())
160 {
161 try
162 {
163 // linux mac os specifics
164 signals = new Mono.Unix.UnixSignal[]
165 {
166 new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM)
167 };
168 signal_thread.IsBackground = true;
169 signal_thread.Start();
170 }
171 catch (Exception e)
172 {
173 m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not");
174 m_log.InfoFormat("shut down gracefully: {0}", e.Message);
175 m_log.Debug("Exception was: ", e);
176 }
177 }
178#endif
137 //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); 179 //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
138 // http://msdn.microsoft.com/en-us/library/bb384202.aspx 180 // http://msdn.microsoft.com/en-us/library/bb384202.aspx
139 //GCSettings.LatencyMode = GCLatencyMode.Batch; 181 //GCSettings.LatencyMode = GCLatencyMode.Batch;
@@ -172,10 +214,12 @@ namespace OpenSim
172 MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this)); 214 MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
173 if (userStatsURI != String.Empty) 215 if (userStatsURI != String.Empty)
174 MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this)); 216 MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this));
217 MainServer.Instance.AddStreamHandler(new OpenSim.SimRobotsHandler());
175 218
176 if (managedStatsURI != String.Empty) 219 if (managedStatsURI != String.Empty)
177 { 220 {
178 string urlBase = String.Format("/{0}/", managedStatsURI); 221 string urlBase = String.Format("/{0}/", managedStatsURI);
222 StatsManager.StatsPassword = managedStatsPassword;
179 MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest); 223 MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest);
180 m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase); 224 m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase);
181 } 225 }
@@ -217,7 +261,7 @@ namespace OpenSim
217 // Start timer script (run a script every xx seconds) 261 // Start timer script (run a script every xx seconds)
218 if (m_timedScript != "disabled") 262 if (m_timedScript != "disabled")
219 { 263 {
220 m_scriptTimer = new Timer(); 264 m_scriptTimer = new System.Timers.Timer();
221 m_scriptTimer.Enabled = true; 265 m_scriptTimer.Enabled = true;
222 m_scriptTimer.Interval = m_timeInterval*1000; 266 m_scriptTimer.Interval = m_timeInterval*1000;
223 m_scriptTimer.Elapsed += RunAutoTimerScript; 267 m_scriptTimer.Elapsed += RunAutoTimerScript;
@@ -238,55 +282,65 @@ namespace OpenSim
238 282
239 m_console.Commands.AddCommand("General", false, "change region", 283 m_console.Commands.AddCommand("General", false, "change region",
240 "change region <region name>", 284 "change region <region name>",
241 "Change current console region", 285 "Change current console region",
242 ChangeSelectedRegion); 286 ChangeSelectedRegion);
243 287
244 m_console.Commands.AddCommand("Archiving", false, "save xml", 288 m_console.Commands.AddCommand("Archiving", false, "save xml",
245 "save xml", 289 "save xml [<file name>]",
246 "Save a region's data in XML format", 290 "Save a region's data in XML format",
247 SaveXml); 291 SaveXml);
248 292
249 m_console.Commands.AddCommand("Archiving", false, "save xml2", 293 m_console.Commands.AddCommand("Archiving", false, "save xml2",
250 "save xml2", 294 "save xml2 [<file name>]",
251 "Save a region's data in XML2 format", 295 "Save a region's data in XML2 format",
252 SaveXml2); 296 SaveXml2);
253 297
254 m_console.Commands.AddCommand("Archiving", false, "load xml", 298 m_console.Commands.AddCommand("Archiving", false, "load xml",
255 "load xml [-newIDs [<x> <y> <z>]]", 299 "load xml [<file name> [-newUID [<x> <y> <z>]]]",
256 "Load a region's data from XML format", 300 "Load a region's data from XML format",
257 LoadXml); 301 LoadXml);
258 302
259 m_console.Commands.AddCommand("Archiving", false, "load xml2", 303 m_console.Commands.AddCommand("Archiving", false, "load xml2",
260 "load xml2", 304 "load xml2 [<file name>]",
261 "Load a region's data from XML2 format", 305 "Load a region's data from XML2 format",
262 LoadXml2); 306 LoadXml2);
263 307
264 m_console.Commands.AddCommand("Archiving", false, "save prims xml2", 308 m_console.Commands.AddCommand("Archiving", false, "save prims xml2",
265 "save prims xml2 [<prim name> <file name>]", 309 "save prims xml2 [<prim name> <file name>]",
266 "Save named prim to XML2", 310 "Save named prim to XML2",
267 SavePrimsXml2); 311 SavePrimsXml2);
268 312
269 m_console.Commands.AddCommand("Archiving", false, "load oar", 313 m_console.Commands.AddCommand("Archiving", false, "load oar",
270 "load oar [--merge] [--skip-assets]" 314 "load oar [-m|--merge] [-s|--skip-assets]"
271 + " [--default-user \"User Name\"]" 315 + " [--default-user \"User Name\"]"
272 + " [--force-terrain] [--force-parcels]" 316 + " [--force-terrain] [--force-parcels]"
273 + " [--no-objects]" 317 + " [--no-objects]"
274 + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" 318 + " [--rotation degrees]"
275 + " [--displacement \"<x,y,z>\"]" 319 + " [--bounding-origin \"<x,y,z>\"]"
320 + " [--bounding-size \"<x,y,z>\"]"
321 + " [--displacement \"<x,y,z>\"]"
322 + " [-d|--debug]"
276 + " [<OAR path>]", 323 + " [<OAR path>]",
277 "Load a region's data from an OAR archive.", 324 "Load a region's data from an OAR archive.",
278 "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading).\n" 325 "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading).\n"
326 + "--skip-assets will load the OAR but ignore the assets it contains.\n"
279 + "--default-user will use this user for any objects with an owner whose UUID is not found in the grid.\n" 327 + "--default-user will use this user for any objects with an owner whose UUID is not found in the grid.\n"
280 + "--displacement will add this value to the position of every object loaded.\n"
281 + "--force-terrain forces the loading of terrain from the oar (undoes suppression done by --merge).\n" 328 + "--force-terrain forces the loading of terrain from the oar (undoes suppression done by --merge).\n"
282 + "--force-parcels forces the loading of parcels from the oar (undoes suppression done by --merge).\n" 329 + "--force-parcels forces the loading of parcels from the oar (undoes suppression done by --merge).\n"
283 + "--no-objects suppresses the addition of any objects (good for loading only the terrain).\n" 330 + "--no-objects suppresses the addition of any objects (good for loading only the terrain).\n"
284 + "--rotation specified rotation to be applied to the oar. Specified in degrees.\n" 331 + "--rotation specified rotation to be applied to the oar. Specified in degrees.\n"
285 + "--rotation-center Location (relative to original OAR) to apply rotation. Default is <128,128,0>.\n" 332 + "--bounding-origin will only place objects that after displacement and rotation fall within the bounding cube who's position starts at <x,y,z>. Defaults to <0,0,0>.\n"
286 + "--skip-assets will load the OAR but ignore the assets it contains.\n\n" 333 + "--bounding-size specifies the size of the bounding cube. The default is the size of the destination region and cannot be larger than this.\n"
334 + "--displacement will add this value to the position of every object loaded.\n"
335 + "--debug forces the archiver to display messages about where each object is being placed.\n\n"
287 + "The path can be either a filesystem location or a URI.\n" 336 + "The path can be either a filesystem location or a URI.\n"
288 + " If this is not given then the command looks for an OAR named region.oar in the current directory.", 337 + " If this is not given then the command looks for an OAR named region.oar in the current directory."
289 LoadOar); 338 + " [--rotation-center \"<x,y,z>\"] used to be an option, now it does nothing and will be removed soon."
339 + "When an OAR is being loaded, operations are applied in this order:\n"
340 + "1: Rotation (around the incoming OARs region center)\n"
341 + "2: Cropping (a bounding cube with origin and size)\n"
342 + "3: Displacement (setting offset coordinates within the destination region)",
343 LoadOar); ;
290 344
291 m_console.Commands.AddCommand("Archiving", false, "save oar", 345 m_console.Commands.AddCommand("Archiving", false, "save oar",
292 //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]", 346 //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
@@ -307,12 +361,12 @@ namespace OpenSim
307 361
308 m_console.Commands.AddCommand("Objects", false, "edit scale", 362 m_console.Commands.AddCommand("Objects", false, "edit scale",
309 "edit scale <name> <x> <y> <z>", 363 "edit scale <name> <x> <y> <z>",
310 "Change the scale of a named prim", 364 "Change the scale of a named prim",
311 HandleEditScale); 365 HandleEditScale);
312 366
313 m_console.Commands.AddCommand("Objects", false, "rotate scene", 367 m_console.Commands.AddCommand("Objects", false, "rotate scene",
314 "rotate scene <degrees> [centerX, centerY]", 368 "rotate scene <degrees> [centerX, centerY]",
315 "Rotates all scene objects around centerX, centerY (defailt 128, 128) (please back up your region before using)", 369 "Rotates all scene objects around centerX, centerY (default 128, 128) (please back up your region before using)",
316 HandleRotateScene); 370 HandleRotateScene);
317 371
318 m_console.Commands.AddCommand("Objects", false, "scale scene", 372 m_console.Commands.AddCommand("Objects", false, "scale scene",
@@ -334,44 +388,44 @@ namespace OpenSim
334 388
335 m_console.Commands.AddCommand("Users", false, "show users", 389 m_console.Commands.AddCommand("Users", false, "show users",
336 "show users [full]", 390 "show users [full]",
337 "Show user data for users currently on the region", 391 "Show user data for users currently on the region",
338 "Without the 'full' option, only users actually on the region are shown." 392 "Without the 'full' option, only users actually on the region are shown."
339 + " With the 'full' option child agents of users in neighbouring regions are also shown.", 393 + " With the 'full' option child agents of users in neighbouring regions are also shown.",
340 HandleShow); 394 HandleShow);
341 395
342 m_console.Commands.AddCommand("Comms", false, "show connections", 396 m_console.Commands.AddCommand("Comms", false, "show connections",
343 "show connections", 397 "show connections",
344 "Show connection data", 398 "Show connection data",
345 HandleShow); 399 HandleShow);
346 400
347 m_console.Commands.AddCommand("Comms", false, "show circuits", 401 m_console.Commands.AddCommand("Comms", false, "show circuits",
348 "show circuits", 402 "show circuits",
349 "Show agent circuit data", 403 "Show agent circuit data",
350 HandleShow); 404 HandleShow);
351 405
352 m_console.Commands.AddCommand("Comms", false, "show pending-objects", 406 m_console.Commands.AddCommand("Comms", false, "show pending-objects",
353 "show pending-objects", 407 "show pending-objects",
354 "Show # of objects on the pending queues of all scene viewers", 408 "Show # of objects on the pending queues of all scene viewers",
355 HandleShow); 409 HandleShow);
356 410
357 m_console.Commands.AddCommand("General", false, "show modules", 411 m_console.Commands.AddCommand("General", false, "show modules",
358 "show modules", 412 "show modules",
359 "Show module data", 413 "Show module data",
360 HandleShow); 414 HandleShow);
361 415
362 m_console.Commands.AddCommand("Regions", false, "show regions", 416 m_console.Commands.AddCommand("Regions", false, "show regions",
363 "show regions", 417 "show regions",
364 "Show region data", 418 "Show region data",
365 HandleShow); 419 HandleShow);
366 420
367 m_console.Commands.AddCommand("Regions", false, "show ratings", 421 m_console.Commands.AddCommand("Regions", false, "show ratings",
368 "show ratings", 422 "show ratings",
369 "Show rating data", 423 "Show rating data",
370 HandleShow); 424 HandleShow);
371 425
372 m_console.Commands.AddCommand("Objects", false, "backup", 426 m_console.Commands.AddCommand("Objects", false, "backup",
373 "backup", 427 "backup",
374 "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", 428 "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.",
375 RunCommand); 429 RunCommand);
376 430
377 m_console.Commands.AddCommand("Regions", false, "create region", 431 m_console.Commands.AddCommand("Regions", false, "create region",
@@ -385,22 +439,22 @@ namespace OpenSim
385 439
386 m_console.Commands.AddCommand("Regions", false, "restart", 440 m_console.Commands.AddCommand("Regions", false, "restart",
387 "restart", 441 "restart",
388 "Restart the currently selected region(s) in this instance", 442 "Restart the currently selected region(s) in this instance",
389 RunCommand); 443 RunCommand);
390 444
391 m_console.Commands.AddCommand("General", false, "command-script", 445 m_console.Commands.AddCommand("General", false, "command-script",
392 "command-script <script>", 446 "command-script <script>",
393 "Run a command script from file", 447 "Run a command script from file",
394 RunCommand); 448 RunCommand);
395 449
396 m_console.Commands.AddCommand("Regions", false, "remove-region", 450 m_console.Commands.AddCommand("Regions", false, "remove-region",
397 "remove-region <name>", 451 "remove-region <name>",
398 "Remove a region from this simulator", 452 "Remove a region from this simulator",
399 RunCommand); 453 RunCommand);
400 454
401 m_console.Commands.AddCommand("Regions", false, "delete-region", 455 m_console.Commands.AddCommand("Regions", false, "delete-region",
402 "delete-region <name>", 456 "delete-region <name>",
403 "Delete a region from disk", 457 "Delete a region from disk",
404 RunCommand); 458 RunCommand);
405 459
406 m_console.Commands.AddCommand("Estates", false, "estate create", 460 m_console.Commands.AddCommand("Estates", false, "estate create",
@@ -431,7 +485,13 @@ namespace OpenSim
431 { 485 {
432 RunCommandScript(m_shutdownCommandsFile); 486 RunCommandScript(m_shutdownCommandsFile);
433 } 487 }
434 488
489 if (m_timedScript != "disabled")
490 {
491 m_scriptTimer.Dispose();
492 m_timedScript = "disabled";
493 }
494
435 base.ShutdownSpecific(); 495 base.ShutdownSpecific();
436 } 496 }
437 497
@@ -451,7 +511,6 @@ namespace OpenSim
451 private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi) 511 private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
452 { 512 {
453 int now = Environment.TickCount & Int32.MaxValue; 513 int now = Environment.TickCount & Int32.MaxValue;
454
455 m_log.ErrorFormat( 514 m_log.ErrorFormat(
456 "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}", 515 "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
457 twi.Thread.Name, 516 twi.Thread.Name,
@@ -470,7 +529,7 @@ namespace OpenSim
470 private void KickUserCommand(string module, string[] cmdparams) 529 private void KickUserCommand(string module, string[] cmdparams)
471 { 530 {
472 bool force = false; 531 bool force = false;
473 532
474 OptionSet options = new OptionSet().Add("f|force", delegate (string v) { force = v != null; }); 533 OptionSet options = new OptionSet().Add("f|force", delegate (string v) { force = v != null; });
475 534
476 List<string> mainParams = options.Parse(cmdparams); 535 List<string> mainParams = options.Parse(cmdparams);
@@ -500,7 +559,7 @@ namespace OpenSim
500 if (alert != null) 559 if (alert != null)
501 presence.ControllingClient.Kick(alert); 560 presence.ControllingClient.Kick(alert);
502 else 561 else
503 presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n"); 562 presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n");
504 563
505 presence.Scene.CloseAgent(presence.UUID, force); 564 presence.Scene.CloseAgent(presence.UUID, force);
506 break; 565 break;
@@ -567,7 +626,7 @@ namespace OpenSim
567 MainConsole.Instance.Output(usage); 626 MainConsole.Instance.Output(usage);
568 return; 627 return;
569 } 628 }
570 629
571 float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI); 630 float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI);
572 OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); 631 OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle);
573 632
@@ -579,7 +638,7 @@ namespace OpenSim
579 638
580 Vector3 center = new Vector3(centerX, centerY, 0.0f); 639 Vector3 center = new Vector3(centerX, centerY, 0.0f);
581 640
582 SceneManager.ForEachSelectedScene(delegate(Scene scene) 641 SceneManager.ForEachSelectedScene(delegate(Scene scene)
583 { 642 {
584 scene.ForEachSOG(delegate(SceneObjectGroup sog) 643 scene.ForEachSOG(delegate(SceneObjectGroup sog)
585 { 644 {
@@ -731,8 +790,8 @@ namespace OpenSim
731 CreateRegion(regInfo, true, out scene); 790 CreateRegion(regInfo, true, out scene);
732 791
733 if (changed) 792 if (changed)
734 m_estateDataService.StoreEstateSettings(regInfo.EstateSettings); 793 m_estateDataService.StoreEstateSettings(regInfo.EstateSettings);
735 794
736 scene.Start(); 795 scene.Start();
737 } 796 }
738 797
@@ -835,8 +894,8 @@ namespace OpenSim
835 protected override void HandleRestartRegion(RegionInfo whichRegion) 894 protected override void HandleRestartRegion(RegionInfo whichRegion)
836 { 895 {
837 base.HandleRestartRegion(whichRegion); 896 base.HandleRestartRegion(whichRegion);
838 897
839 // Where we are restarting multiple scenes at once, a previous call to RefreshPrompt may have set the 898 // Where we are restarting multiple scenes at once, a previous call to RefreshPrompt may have set the
840 // m_console.ConsoleScene to null (indicating all scenes). 899 // m_console.ConsoleScene to null (indicating all scenes).
841 if (m_console.ConsoleScene != null && whichRegion.RegionName == ((Scene)m_console.ConsoleScene).Name) 900 if (m_console.ConsoleScene != null && whichRegion.RegionName == ((Scene)m_console.ConsoleScene).Name)
842 SceneManager.TrySetCurrentScene(whichRegion.RegionName); 901 SceneManager.TrySetCurrentScene(whichRegion.RegionName);
@@ -869,7 +928,7 @@ namespace OpenSim
869 { 928 {
870 agents = SceneManager.GetCurrentSceneAvatars(); 929 agents = SceneManager.GetCurrentSceneAvatars();
871 } 930 }
872 931
873 MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); 932 MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count));
874 933
875 MainConsole.Instance.Output( 934 MainConsole.Instance.Output(
@@ -915,7 +974,7 @@ namespace OpenSim
915 974
916 case "modules": 975 case "modules":
917 SceneManager.ForEachSelectedScene( 976 SceneManager.ForEachSelectedScene(
918 scene => 977 scene =>
919 { 978 {
920 MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name); 979 MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name);
921 980
@@ -951,16 +1010,16 @@ namespace OpenSim
951 cdt.AddColumn("Ready?", 6); 1010 cdt.AddColumn("Ready?", 6);
952 cdt.AddColumn("Estate", ConsoleDisplayUtil.EstateNameSize); 1011 cdt.AddColumn("Estate", ConsoleDisplayUtil.EstateNameSize);
953 SceneManager.ForEachScene( 1012 SceneManager.ForEachScene(
954 scene => 1013 scene =>
955 { 1014 {
956 RegionInfo ri = scene.RegionInfo; 1015 RegionInfo ri = scene.RegionInfo;
957 cdt.AddRow( 1016 cdt.AddRow(
958 ri.RegionName, 1017 ri.RegionName,
959 ri.RegionID, 1018 ri.RegionID,
960 string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY), 1019 string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY),
961 string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY), 1020 string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY),
962 ri.InternalEndPoint.Port, 1021 ri.InternalEndPoint.Port,
963 scene.Ready ? "Yes" : "No", 1022 scene.Ready ? "Yes" : "No",
964 ri.EstateSettings.EstateName); 1023 ri.EstateSettings.EstateName);
965 } 1024 }
966 ); 1025 );
@@ -1028,15 +1087,25 @@ namespace OpenSim
1028 cdt.AddColumn("Circuit code", 12); 1087 cdt.AddColumn("Circuit code", 12);
1029 cdt.AddColumn("Endpoint", 23); 1088 cdt.AddColumn("Endpoint", 23);
1030 cdt.AddColumn("Active?", 7); 1089 cdt.AddColumn("Active?", 7);
1090 cdt.AddColumn("ChildAgent?", 7);
1091 cdt.AddColumn("ping(ms)", 8);
1031 1092
1032 SceneManager.ForEachScene( 1093 SceneManager.ForEachScene(
1033 s => s.ForEachClient( 1094 s => s.ForEachClient(
1034 c => cdt.AddRow( 1095 c =>
1035 s.Name, 1096 {
1036 c.Name, 1097 bool child = false;
1037 c.CircuitCode.ToString(), 1098 if(c.SceneAgent != null && c.SceneAgent.IsChildAgent)
1038 c.RemoteEndPoint.ToString(), 1099 child = true;
1039 c.IsActive.ToString()))); 1100 cdt.AddRow(
1101 s.Name,
1102 c.Name,
1103 c.CircuitCode.ToString(),
1104 c.RemoteEndPoint.ToString(),
1105 c.IsActive.ToString(),
1106 child.ToString(),
1107 c.PingTimeMS);
1108 }));
1040 1109
1041 MainConsole.Instance.Output(cdt.ToString()); 1110 MainConsole.Instance.Output(cdt.ToString());
1042 } 1111 }
@@ -1048,7 +1117,7 @@ namespace OpenSim
1048 /// <param name="cmdparams"></param> 1117 /// <param name="cmdparams"></param>
1049 protected void SavePrimsXml2(string module, string[] cmdparams) 1118 protected void SavePrimsXml2(string module, string[] cmdparams)
1050 { 1119 {
1051 if (cmdparams.Length > 5) 1120 if (cmdparams.Length > 4)
1052 { 1121 {
1053 SceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]); 1122 SceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]);
1054 } 1123 }
@@ -1067,7 +1136,7 @@ namespace OpenSim
1067 { 1136 {
1068 MainConsole.Instance.Output("PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); 1137 MainConsole.Instance.Output("PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
1069 1138
1070 if (cmdparams.Length > 0) 1139 if (cmdparams.Length > 2)
1071 { 1140 {
1072 SceneManager.SaveCurrentSceneToXml(cmdparams[2]); 1141 SceneManager.SaveCurrentSceneToXml(cmdparams[2]);
1073 } 1142 }
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index ab6f036..9f349c0 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -85,9 +85,10 @@ namespace OpenSim
85 85
86 protected string proxyUrl; 86 protected string proxyUrl;
87 protected int proxyOffset = 0; 87 protected int proxyOffset = 0;
88 88
89 public string userStatsURI = String.Empty; 89 public string userStatsURI = String.Empty;
90 public string managedStatsURI = String.Empty; 90 public string managedStatsURI = String.Empty;
91 public string managedStatsPassword = String.Empty;
91 92
92 protected bool m_autoCreateClientStack = true; 93 protected bool m_autoCreateClientStack = true;
93 94
@@ -110,6 +111,10 @@ namespace OpenSim
110 111
111 public List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>(); 112 public List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
112 113
114 private List<string> m_permsModules;
115
116 private bool m_securePermissionsLoading = true;
117
113 /// <value> 118 /// <value>
114 /// The config information passed into the OpenSimulator region server. 119 /// The config information passed into the OpenSimulator region server.
115 /// </value> 120 /// </value>
@@ -121,7 +126,7 @@ namespace OpenSim
121 { 126 {
122 get { return m_EnvConfigSource; } 127 get { return m_EnvConfigSource; }
123 } 128 }
124 129
125 public uint HttpServerPort 130 public uint HttpServerPort
126 { 131 {
127 get { return m_httpServerPort; } 132 get { return m_httpServerPort; }
@@ -206,7 +211,7 @@ namespace OpenSim
206 } 211 }
207 212
208 /// <summary> 213 /// <summary>
209 /// Performs startup specific to the region server, including initialization of the scene 214 /// Performs startup specific to the region server, including initialization of the scene
210 /// such as loading configuration from disk. 215 /// such as loading configuration from disk.
211 /// </summary> 216 /// </summary>
212 protected override void StartupSpecific() 217 protected override void StartupSpecific()
@@ -214,12 +219,28 @@ namespace OpenSim
214 IConfig startupConfig = Config.Configs["Startup"]; 219 IConfig startupConfig = Config.Configs["Startup"];
215 if (startupConfig != null) 220 if (startupConfig != null)
216 { 221 {
222 // refuse to run MegaRegions
223 if(startupConfig.GetBoolean("CombineContiguousRegions", false))
224 {
225 m_log.Fatal("CombineContiguousRegions (MegaRegions) option is no longer suported. Use a older version to save region contents as OAR, then import into a fresh install of this new version");
226 throw new Exception("CombineContiguousRegions not suported");
227 }
228
217 string pidFile = startupConfig.GetString("PIDFile", String.Empty); 229 string pidFile = startupConfig.GetString("PIDFile", String.Empty);
218 if (pidFile != String.Empty) 230 if (pidFile != String.Empty)
219 CreatePIDFile(pidFile); 231 CreatePIDFile(pidFile);
220 232
221 userStatsURI = startupConfig.GetString("Stats_URI", String.Empty); 233 userStatsURI = startupConfig.GetString("Stats_URI", String.Empty);
234
235 m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true);
236
237 string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules",
238 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
239
240 m_permsModules = new List<string>(permissionModules.Split(',').Select(m => m.Trim()));
241
222 managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty); 242 managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
243 managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty);
223 } 244 }
224 245
225 // Load the simulation data service 246 // Load the simulation data service
@@ -235,11 +256,11 @@ namespace OpenSim
235 if (m_simulationDataService == null) 256 if (m_simulationDataService == null)
236 throw new Exception( 257 throw new Exception(
237 string.Format( 258 string.Format(
238 "Could not load an ISimulationDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [SimulationDataStore] config section.", 259 "Could not load an ISimulationDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [SimulationDataStore] config section.",
239 module)); 260 module));
240 261
241 // Load the estate data service 262 // Load the estate data service
242 module = Util.GetConfigVarFromSections<string>(Config, "LocalServiceModule", new string[]{"EstateDataStore", "EstateService"}, String.Empty); 263 module = Util.GetConfigVarFromSections<string>(Config, "LocalServiceModule", new string[]{"EstateDataStore", "EstateService"}, String.Empty);
243 if (String.IsNullOrEmpty(module)) 264 if (String.IsNullOrEmpty(module))
244 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] or [EstateService] section"); 265 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] or [EstateService] section");
245 266
@@ -249,7 +270,7 @@ namespace OpenSim
249 if (m_estateDataService == null) 270 if (m_estateDataService == null)
250 throw new Exception( 271 throw new Exception(
251 string.Format( 272 string.Format(
252 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.", 273 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
253 module)); 274 module));
254 } 275 }
255 276
@@ -386,9 +407,9 @@ namespace OpenSim
386 // set initial ServerURI 407 // set initial ServerURI
387 regionInfo.HttpPort = m_httpServerPort; 408 regionInfo.HttpPort = m_httpServerPort;
388 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; 409 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/";
389 410
390 regionInfo.osSecret = m_osSecret; 411 regionInfo.osSecret = m_osSecret;
391 412
392 if ((proxyUrl.Length > 0) && (portadd_flag)) 413 if ((proxyUrl.Length > 0) && (portadd_flag))
393 { 414 {
394 // set proxy url to RegionInfo 415 // set proxy url to RegionInfo
@@ -410,19 +431,48 @@ namespace OpenSim
410 } 431 }
411 else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing..."); 432 else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
412 433
434 if (m_securePermissionsLoading)
435 {
436 foreach (string s in m_permsModules)
437 {
438 if (!scene.RegionModules.ContainsKey(s))
439 {
440 m_log.Fatal("[MODULES]: Required module " + s + " not found.");
441 Environment.Exit(0);
442 }
443 }
444
445 m_log.InfoFormat("[SCENE]: Secure permissions loading enabled, modules loaded: {0}", String.Join(" ", m_permsModules.ToArray()));
446 }
447
413 scene.SetModuleInterfaces(); 448 scene.SetModuleInterfaces();
449// First Step of bootreport sequence
450 if (scene.SnmpService != null)
451 {
452 scene.SnmpService.ColdStart(1,scene);
453 scene.SnmpService.LinkDown(scene);
454 }
455
456 if (scene.SnmpService != null)
457 {
458 scene.SnmpService.BootInfo("Loading prims", scene);
459 }
414 460
415 while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 461 while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
416 SetUpEstateOwner(scene); 462 SetUpEstateOwner(scene);
417 463
464 scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
465
418 // Prims have to be loaded after module configuration since some modules may be invoked during the load 466 // Prims have to be loaded after module configuration since some modules may be invoked during the load
419 scene.LoadPrimsFromStorage(regionInfo.originRegionID); 467 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
420 468
421 // TODO : Try setting resource for region xstats here on scene 469 // TODO : Try setting resource for region xstats here on scene
422 MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo)); 470 MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo));
423 471
424 scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); 472 if (scene.SnmpService != null)
425 scene.EventManager.TriggerParcelPrimCountUpdate(); 473 {
474 scene.SnmpService.BootInfo("Grid Registration in progress", scene);
475 }
426 476
427 try 477 try
428 { 478 {
@@ -431,18 +481,32 @@ namespace OpenSim
431 catch (Exception e) 481 catch (Exception e)
432 { 482 {
433 m_log.ErrorFormat( 483 m_log.ErrorFormat(
434 "[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}", 484 "[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}",
435 e.Message, e.StackTrace); 485 e.Message, e.StackTrace);
436 486
487 if (scene.SnmpService != null)
488 {
489 scene.SnmpService.Critical("Grid registration failed. Startup aborted.", scene);
490 }
437 // Carrying on now causes a lot of confusion down the 491 // Carrying on now causes a lot of confusion down the
438 // line - we need to get the user's attention 492 // line - we need to get the user's attention
439 Environment.Exit(1); 493 Environment.Exit(1);
440 } 494 }
441 495
496 if (scene.SnmpService != null)
497 {
498 scene.SnmpService.BootInfo("Grid Registration done", scene);
499 }
500
442 // We need to do this after we've initialized the 501 // We need to do this after we've initialized the
443 // scripting engines. 502 // scripting engines.
444 scene.CreateScriptInstances(); 503 scene.CreateScriptInstances();
445 504
505 if (scene.SnmpService != null)
506 {
507 scene.SnmpService.BootInfo("ScriptEngine started", scene);
508 }
509
446 SceneManager.Add(scene); 510 SceneManager.Add(scene);
447 511
448 //if (m_autoCreateClientStack) 512 //if (m_autoCreateClientStack)
@@ -454,10 +518,20 @@ namespace OpenSim
454 // } 518 // }
455 //} 519 //}
456 520
521 if (scene.SnmpService != null)
522 {
523 scene.SnmpService.BootInfo("Initializing region modules", scene);
524 }
457 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; 525 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
458 526
459 mscene = scene; 527 mscene = scene;
460 528
529 if (scene.SnmpService != null)
530 {
531 scene.SnmpService.BootInfo("The region is operational", scene);
532 scene.SnmpService.LinkUp(scene);
533 }
534
461 //return clientServers; 535 //return clientServers;
462 } 536 }
463 537
@@ -535,7 +609,7 @@ namespace OpenSim
535 609
536 if (rawEstateOwnerUuid == null) 610 if (rawEstateOwnerUuid == null)
537 rawEstateOwnerUuid = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString()); 611 rawEstateOwnerUuid = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString());
538 612
539 UUID estateOwnerUuid = UUID.Zero; 613 UUID estateOwnerUuid = UUID.Zero;
540 if (!UUID.TryParse(rawEstateOwnerUuid, out estateOwnerUuid)) 614 if (!UUID.TryParse(rawEstateOwnerUuid, out estateOwnerUuid))
541 { 615 {
@@ -573,6 +647,11 @@ namespace OpenSim
573 private void ShutdownRegion(Scene scene) 647 private void ShutdownRegion(Scene scene)
574 { 648 {
575 m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName); 649 m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName);
650 if (scene.SnmpService != null)
651 {
652 scene.SnmpService.BootInfo("The region is shutting down", scene);
653 scene.SnmpService.LinkDown(scene);
654 }
576 IRegionModulesController controller; 655 IRegionModulesController controller;
577 if (ApplicationRegistry.TryGet<IRegionModulesController>(out controller)) 656 if (ApplicationRegistry.TryGet<IRegionModulesController>(out controller))
578 { 657 {
@@ -593,7 +672,7 @@ namespace OpenSim
593 scene.DeleteAllSceneObjects(); 672 scene.DeleteAllSceneObjects();
594 SceneManager.CloseScene(scene); 673 SceneManager.CloseScene(scene);
595 //ShutdownClientServer(scene.RegionInfo); 674 //ShutdownClientServer(scene.RegionInfo);
596 675
597 if (!cleanup) 676 if (!cleanup)
598 return; 677 return;
599 678
@@ -655,7 +734,7 @@ namespace OpenSim
655 SceneManager.CloseScene(scene); 734 SceneManager.CloseScene(scene);
656 //ShutdownClientServer(scene.RegionInfo); 735 //ShutdownClientServer(scene.RegionInfo);
657 } 736 }
658 737
659 /// <summary> 738 /// <summary>
660 /// Remove a region from the simulator without deleting it permanently. 739 /// Remove a region from the simulator without deleting it permanently.
661 /// </summary> 740 /// </summary>
@@ -667,7 +746,7 @@ namespace OpenSim
667 if (SceneManager.TryGetScene(name, out target)) 746 if (SceneManager.TryGetScene(name, out target))
668 CloseRegion(target); 747 CloseRegion(target);
669 } 748 }
670 749
671 /// <summary> 750 /// <summary>
672 /// Create a scene and its initial base structures. 751 /// Create a scene and its initial base structures.
673 /// </summary> 752 /// </summary>
@@ -703,15 +782,15 @@ namespace OpenSim
703 IEstateDataService estateDataService, AgentCircuitManager circuitManager) 782 IEstateDataService estateDataService, AgentCircuitManager circuitManager)
704 { 783 {
705 return new Scene( 784 return new Scene(
706 regionInfo, circuitManager, 785 regionInfo, circuitManager,
707 simDataService, estateDataService, 786 simDataService, estateDataService,
708 Config, m_version); 787 Config, m_version);
709 } 788 }
710 789
711 protected virtual void HandleRestartRegion(RegionInfo whichRegion) 790 protected virtual void HandleRestartRegion(RegionInfo whichRegion)
712 { 791 {
713 m_log.InfoFormat( 792 m_log.InfoFormat(
714 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", 793 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})",
715 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); 794 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY);
716 795
717 //ShutdownClientServer(whichRegion); 796 //ShutdownClientServer(whichRegion);
@@ -746,18 +825,18 @@ namespace OpenSim
746 825
747 /// <summary> 826 /// <summary>
748 /// Handler to supply the current extended status of this sim 827 /// Handler to supply the current extended status of this sim
749 /// Sends the statistical data in a json serialization 828 /// Sends the statistical data in a json serialization
750 /// </summary> 829 /// </summary>
751 public class XSimStatusHandler : BaseStreamHandler 830 public class XSimStatusHandler : BaseStreamHandler
752 { 831 {
753 OpenSimBase m_opensim; 832 OpenSimBase m_opensim;
754 833
755 public XSimStatusHandler(OpenSimBase sim) 834 public XSimStatusHandler(OpenSimBase sim)
756 : base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus") 835 : base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus")
757 { 836 {
758 m_opensim = sim; 837 m_opensim = sim;
759 } 838 }
760 839
761 protected override byte[] ProcessRequest(string path, Stream request, 840 protected override byte[] ProcessRequest(string path, Stream request,
762 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 841 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
763 { 842 {
@@ -772,20 +851,20 @@ namespace OpenSim
772 851
773 /// <summary> 852 /// <summary>
774 /// Handler to supply the current extended status of this sim to a user configured URI 853 /// Handler to supply the current extended status of this sim to a user configured URI
775 /// Sends the statistical data in a json serialization 854 /// Sends the statistical data in a json serialization
776 /// If the request contains a key, "callback" the response will be wrappend in the 855 /// If the request contains a key, "callback" the response will be wrappend in the
777 /// associated value for jsonp used with ajax/javascript 856 /// associated value for jsonp used with ajax/javascript
778 /// </summary> 857 /// </summary>
779 protected class UXSimStatusHandler : BaseStreamHandler 858 protected class UXSimStatusHandler : BaseStreamHandler
780 { 859 {
781 OpenSimBase m_opensim; 860 OpenSimBase m_opensim;
782 861
783 public UXSimStatusHandler(OpenSimBase sim) 862 public UXSimStatusHandler(OpenSimBase sim)
784 : base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus") 863 : base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus")
785 { 864 {
786 m_opensim = sim; 865 m_opensim = sim;
787 } 866 }
788 867
789 protected override byte[] ProcessRequest(string path, Stream request, 868 protected override byte[] ProcessRequest(string path, Stream request,
790 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 869 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
791 { 870 {
@@ -798,6 +877,26 @@ namespace OpenSim
798 } 877 }
799 } 878 }
800 879
880 /// <summary>
881 /// handler to supply serving http://domainname:port/robots.txt
882 /// </summary>
883 public class SimRobotsHandler : BaseStreamHandler
884 {
885 public SimRobotsHandler() : base("GET", "/robots.txt", "SimRobots.txt", "Simulator Robots.txt") {}
886
887 protected override byte[] ProcessRequest(string path, Stream request,
888 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
889 {
890 string robots = "# go away\nUser-agent: *\nDisallow: /\n";
891 return Util.UTF8.GetBytes(robots);
892 }
893
894 public override string ContentType
895 {
896 get { return "text/plain"; }
897 }
898 }
899
801 #endregion 900 #endregion
802 901
803 /// <summary> 902 /// <summary>
@@ -858,7 +957,7 @@ namespace OpenSim
858 { 957 {
859 regionnum = SceneManager.Scenes.Count; 958 regionnum = SceneManager.Scenes.Count;
860 } 959 }
861 960
862 /// <summary> 961 /// <summary>
863 /// Create an estate with an initial region. 962 /// Create an estate with an initial region.
864 /// </summary> 963 /// </summary>
@@ -885,19 +984,19 @@ namespace OpenSim
885 MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName); 984 MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName);
886 return false; 985 return false;
887 } 986 }
888 987
889 regInfo.EstateSettings.EstateName = newName; 988 regInfo.EstateSettings.EstateName = newName;
890 989
891 // FIXME: Later on, the scene constructor will reload the estate settings no matter what. 990 // FIXME: Later on, the scene constructor will reload the estate settings no matter what.
892 // Therefore, we need to do an initial save here otherwise the new estate name will be reset 991 // Therefore, we need to do an initial save here otherwise the new estate name will be reset
893 // back to the default. The reloading of estate settings by scene could be eliminated if it 992 // back to the default. The reloading of estate settings by scene could be eliminated if it
894 // knows that the passed in settings in RegionInfo are already valid. Also, it might be 993 // knows that the passed in settings in RegionInfo are already valid. Also, it might be
895 // possible to eliminate some additional later saves made by callers of this method. 994 // possible to eliminate some additional later saves made by callers of this method.
896 EstateDataService.StoreEstateSettings(regInfo.EstateSettings); 995 EstateDataService.StoreEstateSettings(regInfo.EstateSettings);
897 996
898 return true; 997 return true;
899 } 998 }
900 999
901 /// <summary> 1000 /// <summary>
902 /// Load the estate information for the provided RegionInfo object. 1001 /// Load the estate information for the provided RegionInfo object.
903 /// </summary> 1002 /// </summary>
@@ -911,8 +1010,8 @@ namespace OpenSim
911 return false; // estate info in the database did not change 1010 return false; // estate info in the database did not change
912 1011
913 m_log.WarnFormat("[ESTATE] Region {0} is not part of an estate.", regInfo.RegionName); 1012 m_log.WarnFormat("[ESTATE] Region {0} is not part of an estate.", regInfo.RegionName);
914 1013
915 List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll(); 1014 List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll();
916 Dictionary<string, EstateSettings> estatesByName = new Dictionary<string, EstateSettings>(); 1015 Dictionary<string, EstateSettings> estatesByName = new Dictionary<string, EstateSettings>();
917 1016
918 foreach (EstateSettings estate in estates) 1017 foreach (EstateSettings estate in estates)
@@ -1005,12 +1104,12 @@ namespace OpenSim
1005 MainConsole.Instance.Output("Joining the estate failed. Please try again."); 1104 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
1006 } 1105 }
1007 } 1106 }
1008 } 1107 }
1009 1108
1010 return true; // need to update the database 1109 return true; // need to update the database
1011 } 1110 }
1012 } 1111 }
1013 1112
1014 public class OpenSimConfigSource 1113 public class OpenSimConfigSource
1015 { 1114 {
1016 public IConfigSource Source; 1115 public IConfigSource Source;
diff --git a/OpenSim/Region/Application/Properties/AssemblyInfo.cs b/OpenSim/Region/Application/Properties/AssemblyInfo.cs
index 26990f7..09772d3 100644
--- a/OpenSim/Region/Application/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Application/Properties/AssemblyInfo.cs
@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins; 4using Mono.Addins;
5 5
6// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
7// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
8// associated with an assembly. 8// associated with an assembly.
9[assembly: AssemblyTitle("OpenSim")] 9[assembly: AssemblyTitle("OpenSim")]
@@ -15,8 +15,8 @@ using Mono.Addins;
15[assembly: AssemblyTrademark("")] 15[assembly: AssemblyTrademark("")]
16[assembly: AssemblyCulture("")] 16[assembly: AssemblyCulture("")]
17 17
18// Setting ComVisible to false makes the types in this assembly not visible 18// Setting ComVisible to false makes the types in this assembly not visible
19// to COM components. If you need to access a type in this assembly from 19// to COM components. If you need to access a type in this assembly from
20// COM, set the ComVisible attribute to true on that type. 20// COM, set the ComVisible attribute to true on that type.
21[assembly: ComVisible(false)] 21[assembly: ComVisible(false)]
22 22
@@ -26,11 +26,11 @@ using Mono.Addins;
26// Version information for an assembly consists of the following four values: 26// Version information for an assembly consists of the following four values:
27// 27//
28// Major Version 28// Major Version
29// Minor Version 29// Minor Version
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
33[assembly: AssemblyVersion("0.8.3.*")] 33[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
34 34
35[assembly: AddinRoot("OpenSim", OpenSim.VersionInfo.VersionNumber)] 35[assembly: AddinRoot("OpenSim", OpenSim.VersionInfo.VersionNumber)]
36[assembly: ImportAddinAssembly("OpenSim.Framework.dll")] 36[assembly: ImportAddinAssembly("OpenSim.Framework.dll")]
diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs
index 08c8579..83a9fff 100644
--- a/OpenSim/Region/Application/RegionApplicationBase.cs
+++ b/OpenSim/Region/Application/RegionApplicationBase.cs
@@ -57,9 +57,9 @@ namespace OpenSim
57 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } 57 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
58 public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } 58 public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
59 public IEstateDataService EstateDataService { get { return m_estateDataService; } } 59 public IEstateDataService EstateDataService { get { return m_estateDataService; } }
60 60
61 protected abstract void Initialize(); 61 protected abstract void Initialize();
62 62
63 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); 63 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
64 64
65 protected override void StartupSpecific() 65 protected override void StartupSpecific()
@@ -68,11 +68,11 @@ namespace OpenSim
68 68
69 Initialize(); 69 Initialize();
70 70
71 m_httpServer 71 m_httpServer
72 = new BaseHttpServer( 72 = new BaseHttpServer(
73 m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort, 73 m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort,
74 m_networkServersInfo.HttpSSLCN); 74 m_networkServersInfo.HttpSSLCN);
75 75
76 if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) 76 if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort))
77 { 77 {
78 m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); 78 m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
@@ -87,17 +87,29 @@ namespace OpenSim
87 // "OOB" Server 87 // "OOB" Server
88 if (m_networkServersInfo.ssl_listener) 88 if (m_networkServersInfo.ssl_listener)
89 { 89 {
90 BaseHttpServer server = new BaseHttpServer( 90 if (!m_networkServersInfo.ssl_external)
91 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, 91 {
92 m_networkServersInfo.cert_pass); 92 BaseHttpServer server = new BaseHttpServer(
93 m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path,
94 m_networkServersInfo.cert_pass);
93 95
94 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); 96 m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port);
95 MainServer.AddHttpServer(server); 97 MainServer.AddHttpServer(server);
96 server.Start(); 98 server.Start();
99 }
100 else
101 {
102 BaseHttpServer server = new BaseHttpServer(
103 m_networkServersInfo.https_port);
104
105 m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port);
106 MainServer.AddHttpServer(server);
107 server.Start();
108 }
97 } 109 }
98 110
99 base.StartupSpecific(); 111 base.StartupSpecific();
100 } 112 }
101 113
102 } 114 }
103} \ No newline at end of file 115}