diff --git a/OpenSim.sln b/OpenSim.sln index 7c90f02ff78..2dee1a4193e 100644 --- a/OpenSim.sln +++ b/OpenSim.sln @@ -37,7 +37,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework", "OpenSi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.AssetLoader.Filesystem", "OpenSim\Framework\AssetLoader\Filesystem\OpenSim.Framework.AssetLoader.Filesystem.csproj", "{384A4FAB-0000-0000-0000-000000000000}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Console", "OpenSim\Framework\Console\OpenSim.Framework.Console.csproj", "{0ED8EBE8-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Console", "Source\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj", "{0ED8EBE8-0000-0000-0000-000000000000}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Monitoring", "OpenSim\Framework\Monitoring\OpenSim.Framework.Monitoring.csproj", "{69AB1BC7-0000-0000-0000-000000000000}" EndProject @@ -135,9 +135,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Tools.Configger", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSimSearch.Modules", "addon-modules\OpenSimSearch\Modules\OpenSimSearch.Modules.csproj", "{BE5D1132-0000-0000-0000-000000000000}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pCampBot", "OpenSim\Tools\pCampBot\pCampBot.csproj", "{AF52AEDC-0000-0000-0000-000000000000}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.RobustServer", "OpenSim\Server\RobustServer\OpenSim.Server.RobustServer.csproj", "{6E64F01D-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.RobustServer", "Source\OpenSim.Server.RobustServer\OpenSim.Server.RobustServer.csproj", "{6E64F01D-0000-0000-0000-000000000000}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmartThreadPool", "ThirdParty\SmartThreadPool\SmartThreadPool.csproj", "{8C618053-0000-0000-0000-000000000000}" EndProject @@ -145,9 +143,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Data.MySQL.MoneyDat EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.OptionalModules.Currency", "addon-modules\OpenSim.Region.OptionalModules.Currency\OpenSim.Region.OptionalModules.Currency\OpenSim.Region.OptionalModules.Currency.csproj", "{2B6DD15C-0B5D-41CA-B713-71B60147114D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.MoneyServer", "OpenSim\Server\MoneyServer\OpenSim.Server.MoneyServer.csproj", "{C3AEE6AC-BE40-4003-A7A3-E8AA039E4451}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.MoneyServer", "Source\OpenSim.Server.MoneyServer\OpenSim.Server.MoneyServer.csproj", "{C3AEE6AC-BE40-4003-A7A3-E8AA039E4451}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.RegionServer", "Source\OpenSim.Server.RegionServer\OpenSim.Server.RegionServer.csproj", "{03E1D988-8F42-44E2-B42A-6952090AEC88}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.RegionServer", "OpenSim\Server\RegionServer\OpenSim.Server.RegionServer.csproj", "{03E1D988-8F42-44E2-B42A-6952090AEC88}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.Common", "Source\OpenSim.Server.Common\OpenSim.Server.Common.csproj", "{14B10CB1-EE07-438B-B9C9-E7C241579269}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -419,10 +419,6 @@ Global {BE5D1132-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {BE5D1132-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {BE5D1132-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {AF52AEDC-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AF52AEDC-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF52AEDC-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF52AEDC-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {6E64F01D-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6E64F01D-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {6E64F01D-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -447,6 +443,10 @@ Global {03E1D988-8F42-44E2-B42A-6952090AEC88}.Debug|Any CPU.Build.0 = Debug|Any CPU {03E1D988-8F42-44E2-B42A-6952090AEC88}.Release|Any CPU.ActiveCfg = Release|Any CPU {03E1D988-8F42-44E2-B42A-6952090AEC88}.Release|Any CPU.Build.0 = Release|Any CPU + {14B10CB1-EE07-438B-B9C9-E7C241579269}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14B10CB1-EE07-438B-B9C9-E7C241579269}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14B10CB1-EE07-438B-B9C9-E7C241579269}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14B10CB1-EE07-438B-B9C9-E7C241579269}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/OpenSim/ApplicationPlugins/LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj b/OpenSim/ApplicationPlugins/LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj index 581fa7a7401..aa869f4edde 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj +++ b/OpenSim/ApplicationPlugins/LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj @@ -26,7 +26,7 @@ - + diff --git a/OpenSim/ApplicationPlugins/RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj b/OpenSim/ApplicationPlugins/RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj index cc3cf1ef082..a93be94d96e 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj +++ b/OpenSim/ApplicationPlugins/RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj @@ -39,7 +39,7 @@ - + diff --git a/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj b/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj index 34d61f4d5cb..97f305c1ca3 100644 --- a/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj +++ b/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj @@ -27,7 +27,7 @@ - + diff --git a/OpenSim/ConsoleClient/OpenSim.ConsoleClient.csproj b/OpenSim/ConsoleClient/OpenSim.ConsoleClient.csproj index 4d23514703e..de9e12ed8a7 100644 --- a/OpenSim/ConsoleClient/OpenSim.ConsoleClient.csproj +++ b/OpenSim/ConsoleClient/OpenSim.ConsoleClient.csproj @@ -19,10 +19,10 @@ - + diff --git a/OpenSim/Data/MySQL/OpenSim.Data.MySQL.csproj b/OpenSim/Data/MySQL/OpenSim.Data.MySQL.csproj index 0d73426830d..822c9ba7d41 100644 --- a/OpenSim/Data/MySQL/OpenSim.Data.MySQL.csproj +++ b/OpenSim/Data/MySQL/OpenSim.Data.MySQL.csproj @@ -23,7 +23,7 @@ - + diff --git a/OpenSim/Data/Null/OpenSim.Data.Null.csproj b/OpenSim/Data/Null/OpenSim.Data.Null.csproj index 2629ae354cb..3d968b4fb21 100644 --- a/OpenSim/Data/Null/OpenSim.Data.Null.csproj +++ b/OpenSim/Data/Null/OpenSim.Data.Null.csproj @@ -15,7 +15,7 @@ - + diff --git a/OpenSim/Data/PGSQL/OpenSim.Data.PGSQL.csproj b/OpenSim/Data/PGSQL/OpenSim.Data.PGSQL.csproj index b93316511ef..3241aab784b 100644 --- a/OpenSim/Data/PGSQL/OpenSim.Data.PGSQL.csproj +++ b/OpenSim/Data/PGSQL/OpenSim.Data.PGSQL.csproj @@ -27,7 +27,7 @@ - + diff --git a/OpenSim/Data/SQLite/OpenSim.Data.SQLite.csproj b/OpenSim/Data/SQLite/OpenSim.Data.SQLite.csproj index 357e37ed81d..c242919704f 100644 --- a/OpenSim/Data/SQLite/OpenSim.Data.SQLite.csproj +++ b/OpenSim/Data/SQLite/OpenSim.Data.SQLite.csproj @@ -23,7 +23,7 @@ - + diff --git a/OpenSim/Framework/AssetLoader/Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj b/OpenSim/Framework/AssetLoader/Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj index b19f6d86a99..db11fb0847a 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj +++ b/OpenSim/Framework/AssetLoader/Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj @@ -14,7 +14,7 @@ - + diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs index fdc70b6ed98..69d261f1264 100755 --- a/OpenSim/Framework/ICommandConsole.cs +++ b/OpenSim/Framework/ICommandConsole.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using Microsoft.Extensions.Configuration; using Nini.Config; using System; using System.Collections.Generic; @@ -105,7 +106,8 @@ public interface ICommandConsole : IConsole string ReadLine(string p, bool isCommand, bool e); - void ReadConfig(IConfigSource configSource); + void ReadConfig( ); + void SetCntrCHandler(OnCntrCCelegate handler); } } diff --git a/OpenSim/Framework/Monitoring/OpenSim.Framework.Monitoring.csproj b/OpenSim/Framework/Monitoring/OpenSim.Framework.Monitoring.csproj index 87953e40857..38a91555fc5 100644 --- a/OpenSim/Framework/Monitoring/OpenSim.Framework.Monitoring.csproj +++ b/OpenSim/Framework/Monitoring/OpenSim.Framework.Monitoring.csproj @@ -29,6 +29,8 @@ + + \ No newline at end of file diff --git a/OpenSim/Framework/OpenSim.Framework.csproj b/OpenSim/Framework/OpenSim.Framework.csproj index c3ae4a0a673..045ecd84287 100644 --- a/OpenSim/Framework/OpenSim.Framework.csproj +++ b/OpenSim/Framework/OpenSim.Framework.csproj @@ -33,17 +33,6 @@ - - - - - - - - - - - @@ -149,6 +138,7 @@ + diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 1309351e2bb..d600efc72ab 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers /// /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) /// - public abstract class BaseOpenSimServer : ServerBase + public class BaseOpenSimServer : ServerBase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -74,6 +74,7 @@ public abstract class BaseOpenSimServer : ServerBase public BaseHttpServer HttpServer { get { return m_httpServer; } + set { m_httpServer = value; } } public BaseOpenSimServer() : base() @@ -102,6 +103,7 @@ public static bool ValidateServerCertificate( return false; } + /// /// Must be overriden by child classes for their own server specific startup behaviour. /// @@ -179,7 +181,7 @@ public virtual void Startup() { m_log.Info("[STARTUP]: Beginning startup processing"); - m_log.Info("[STARTUP]: version: " + m_version); + m_log.Info("[STARTUP]: version: " + Version); m_log.InfoFormat("[STARTUP]: Operating system version: {0}, .NET platform {1}, Runtime {2}", Environment.OSVersion, Util.RuntimePlatformStr, Environment.Version.ToString()); m_log.InfoFormat("[STARTUP]: Processor Architecture: {0}({1} {2}bit)", @@ -209,11 +211,11 @@ public string StatReport(IOSHttpRequest httpRequest) // If we catch a request for "callback", wrap the response in the value for jsonp if (httpRequest.QueryAsDictionary.TryGetValue("callback", out string cb) && ! string.IsNullOrEmpty(cb)) { - return cb + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version, id) + ");"; + return cb + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , Version, id) + ");"; } else { - return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version, id); + return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , Version, id); } } } diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 2b378a206a3..04f1b7ac70c 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -23,7 +23,7 @@ - + @@ -101,6 +101,9 @@ + + + diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 9eb653e9009..7b36a6d80d7 100755 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -51,10 +51,17 @@ public class ServerBase public IConfigSource Config { get; protected set; } + /// + /// Server version information. Usually VersionInfo + information about git commit, operating system, etc. + /// + private string m_version; + public string Version { get => m_version; set => m_version = value; } + /// /// Console to be used for any command line output. Can be null, in which case there should be no output. /// protected ICommandConsole m_console; + public ICommandConsole Console { get => m_console; set => m_console = value; } protected OpenSimAppender m_consoleAppender; protected FileAppender m_logFileAppender; @@ -67,15 +74,10 @@ public class ServerBase protected ServerStatsCollector m_serverStatsCollector; - /// - /// Server version information. Usually VersionInfo + information about git commit, operating system, etc. - /// - protected string m_version; - public ServerBase() { m_startuptime = DateTime.Now; - m_version = VersionInfo.Version; + Version = VersionInfo.Version; EnhanceVersionInformation(); } @@ -133,7 +135,7 @@ public void LogEnvironmentInformation() // XmlConfigurator calls first accross servers. m_log.InfoFormat("[SERVER BASE]: Starting in {0}", m_startupDirectory); - m_log.InfoFormat("[SERVER BASE]: OpenSimulator version: {0}", m_version); + m_log.InfoFormat("[SERVER BASE]: OpenSimulator version: {0}", Version); // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and // the clr version number doesn't match the project version number under Mono. @@ -768,7 +770,7 @@ protected void EnhanceVersionInformation() using (StreamReader CommitFile = File.OpenText(manualVersionFileName)) buildVersion = CommitFile.ReadLine(); - m_version += buildVersion ?? ""; + Version += buildVersion ?? ""; } else if (File.Exists(gitRefPointerPath)) { @@ -796,7 +798,7 @@ protected void EnhanceVersionInformation() using (StreamReader refFile = File.OpenText(gitRefPath)) { string gitHash = refFile.ReadLine(); - m_version += gitHash.Substring(0, 7); + Version += gitHash.Substring(0, 7); } } } @@ -806,7 +808,7 @@ protected void EnhanceVersionInformation() public string GetVersionText() { return String.Format("Version: {0} (SIMULATION/{1} - SIMULATION/{2})", - m_version, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax); + Version, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax); } /// diff --git a/OpenSim/Region/ClientStack/Linden/Caps/OpenSim.Region.ClientStack.LindenCaps.csproj b/OpenSim/Region/ClientStack/Linden/Caps/OpenSim.Region.ClientStack.LindenCaps.csproj index ee3cf0029b6..d4e44099828 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/OpenSim.Region.ClientStack.LindenCaps.csproj +++ b/OpenSim/Region/ClientStack/Linden/Caps/OpenSim.Region.ClientStack.LindenCaps.csproj @@ -24,7 +24,7 @@ - + diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSim.Region.ClientStack.LindenUDP.csproj b/OpenSim/Region/ClientStack/Linden/UDP/OpenSim.Region.ClientStack.LindenUDP.csproj index 0ccdcbca217..ac8b93c97f0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSim.Region.ClientStack.LindenUDP.csproj +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSim.Region.ClientStack.LindenUDP.csproj @@ -29,10 +29,10 @@ + - diff --git a/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj b/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj index 8c55800f90c..c6148ef87a4 100644 --- a/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj +++ b/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj @@ -38,7 +38,7 @@ - + diff --git a/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj b/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj index 9c5041792da..f8e477d7ecc 100644 --- a/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj +++ b/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj @@ -30,7 +30,7 @@ - + diff --git a/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj b/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj index 716045345d7..ac135b87a91 100644 --- a/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj +++ b/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj @@ -32,7 +32,7 @@ - + diff --git a/OpenSim/Region/PhysicsModules/BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj b/OpenSim/Region/PhysicsModules/BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj index c640e077c8c..6e114b2fbed 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj +++ b/OpenSim/Region/PhysicsModules/BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj @@ -22,7 +22,7 @@ - + diff --git a/OpenSim/Region/PhysicsModules/Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj b/OpenSim/Region/PhysicsModules/Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj index 64abd36cca0..0e121a8441c 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj +++ b/OpenSim/Region/PhysicsModules/Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj @@ -32,7 +32,7 @@ - + diff --git a/OpenSim/Region/PhysicsModules/SharedBase/OpenSim.Region.PhysicsModules.SharedBase.csproj b/OpenSim/Region/PhysicsModules/SharedBase/OpenSim.Region.PhysicsModules.SharedBase.csproj index 1c648c8e311..b23f1b76a86 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/OpenSim.Region.PhysicsModules.SharedBase.csproj +++ b/OpenSim/Region/PhysicsModules/SharedBase/OpenSim.Region.PhysicsModules.SharedBase.csproj @@ -19,6 +19,6 @@ - + \ No newline at end of file diff --git a/OpenSim/Region/PhysicsModules/ubOde/OpenSim.Region.PhysicsModule.ubOde.csproj b/OpenSim/Region/PhysicsModules/ubOde/OpenSim.Region.PhysicsModule.ubOde.csproj index 310567c5198..3cacd17f789 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/OpenSim.Region.PhysicsModule.ubOde.csproj +++ b/OpenSim/Region/PhysicsModules/ubOde/OpenSim.Region.PhysicsModule.ubOde.csproj @@ -28,7 +28,7 @@ - + diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj b/OpenSim/Region/PhysicsModules/ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj index 226fa813ce0..6384fae64c8 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj @@ -37,7 +37,7 @@ - + diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OpenSim.Region.ScriptEngine.Shared.Api.csproj b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OpenSim.Region.ScriptEngine.Shared.Api.csproj index 3bc365efa69..78c182eef54 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OpenSim.Region.ScriptEngine.Shared.Api.csproj +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OpenSim.Region.ScriptEngine.Shared.Api.csproj @@ -29,7 +29,7 @@ - + diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.csproj b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.csproj index b4b27d0e08f..20983789aa6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.csproj +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.csproj @@ -15,7 +15,7 @@ - + diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/OpenSim.Region.ScriptEngine.Shared.Instance.csproj b/OpenSim/Region/ScriptEngine/Shared/Instance/OpenSim.Region.ScriptEngine.Shared.Instance.csproj index a1ef7498e9a..7bdcb95f98b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/OpenSim.Region.ScriptEngine.Shared.Instance.csproj +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/OpenSim.Region.ScriptEngine.Shared.Instance.csproj @@ -15,7 +15,7 @@ - + diff --git a/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj b/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj index eccf2f94cc5..6b197d8931b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj +++ b/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj @@ -16,7 +16,7 @@ - + diff --git a/OpenSim/Region/ScriptEngine/YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj b/OpenSim/Region/ScriptEngine/YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj index 95a7eec6e9d..d2e544fd35b 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj +++ b/OpenSim/Region/ScriptEngine/YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj @@ -28,7 +28,7 @@ - + diff --git a/OpenSim/Server/Base/OpenSim.Server.Base.csproj b/OpenSim/Server/Base/OpenSim.Server.Base.csproj index e33e4b690e0..98e8cb6e88c 100644 --- a/OpenSim/Server/Base/OpenSim.Server.Base.csproj +++ b/OpenSim/Server/Base/OpenSim.Server.Base.csproj @@ -8,8 +8,7 @@ - - + @@ -26,10 +25,9 @@ + - - - + diff --git a/OpenSim/Server/Base/OpenSimServer.cs b/OpenSim/Server/Base/OpenSimServer.cs new file mode 100644 index 00000000000..6551c9c1e74 --- /dev/null +++ b/OpenSim/Server/Base/OpenSimServer.cs @@ -0,0 +1,816 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Text; +using System.Timers; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Diagnostics; +using System.Runtime; +using System.Runtime.InteropServices; + +using Timer = System.Timers.Timer; + +using OpenMetaverse; + +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Framework.Monitoring; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.Servers; + +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + + +namespace OpenSim.Server.Base +{ + /// + /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) + /// + public class OpenSimServer + { + protected readonly IConfiguration m_configuration; + + protected readonly ILogger m_logger; + + protected ICommandConsole m_console; + + protected BaseHttpServer m_httpServer; // XXX Should be DI instantiated + + protected ServerStatsCollector m_serverStatsCollector; // XXX Should be DI instantiated + + /// + /// Random uuid for private data + /// + protected string m_osSecret = String.Empty; + + protected string m_startupDirectory = Environment.CurrentDirectory; + + protected DateTime m_startuptime; + + private static bool m_NoVerifyCertChain = false; + + private static bool m_NoVerifyCertHostname = false; + + private int m_periodDiagnosticTimerMS = 60 * 60 * 1000; + + /// + /// This will control a periodic log printout of the current 'show stats' (if they are active) for this + /// server. + /// + private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); + + /// + /// Server version information. Usually VersionInfo + information about git commit, operating system, etc. + /// + private string m_version; + + public OpenSimServer( + IConfiguration configuration, + ILogger logger, + ICommandConsole console + ) + { + m_configuration = configuration; + m_logger = logger; + m_console = console; + + MainConsole.Instance = m_console; + + m_osSecret = UUID.Random().ToString(); + + m_startuptime = DateTime.Now; + + Version = VersionInfo.Version; + } + + public ICommandConsole Console { get => m_console; } + + public BaseHttpServer HttpServer + { + get { return m_httpServer; } + set { m_httpServer = value; } + } + + public string osSecret + { + // Secret uuid for the simulator + get { return m_osSecret; } + } + + /// + /// Used by tests to suppress Environment.Exit(0) so that post-run operations are possible. + /// + public bool SuppressExit { get; set; } + + public string Version { get => m_version; set => m_version = value; } + + /// + /// Get a thread pool report. + /// + /// + public static string GetThreadPoolReport() + { + StringBuilder sb = new StringBuilder(); + + // framework pool is alwasy active + int maxWorkers; + int minWorkers; + int curWorkers; + int maxComp; + int minComp; + int curComp; + + try + { + ThreadPool.GetMaxThreads(out maxWorkers, out maxComp); + ThreadPool.GetMinThreads(out minWorkers, out minComp); + ThreadPool.GetAvailableThreads(out curWorkers, out curComp); + curWorkers = maxWorkers - curWorkers; + curComp = maxComp - curComp; + + sb.Append("\nFramework main threadpool \n"); + sb.AppendFormat("workers: {0} ({1} / {2})\n", curWorkers, maxWorkers, minWorkers); + sb.AppendFormat("Completion: {0} ({1} / {2})\n", curComp, maxComp, minComp); + } + catch { } + + if (Util.FireAndForgetMethod == FireAndForgetMethod.QueueUserWorkItem) + { + sb.AppendFormat("\nThread pool used: Framework main threadpool\n"); + return sb.ToString(); + } + + string threadPoolUsed = null; + int maxThreads = 0; + int minThreads = 0; + int allocatedThreads = 0; + int inUseThreads = 0; + int waitingCallbacks = 0; + + if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) + { + STPInfo stpi = Util.GetSmartThreadPoolInfo(); + + // ROBUST currently leaves this the FireAndForgetMethod but never actually initializes the threadpool. + if (stpi != null) + { + threadPoolUsed = "SmartThreadPool"; + maxThreads = stpi.MaxThreads; + minThreads = stpi.MinThreads; + inUseThreads = stpi.InUseThreads; + allocatedThreads = stpi.ActiveThreads; + waitingCallbacks = stpi.WaitingCallbacks; + } + } + + if (threadPoolUsed != null) + { + sb.Append("\nThreadpool (excluding script engine pools)\n"); + sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed); + sb.AppendFormat("Max threads : {0}\n", maxThreads); + sb.AppendFormat("Min threads : {0}\n", minThreads); + sb.AppendFormat("Allocated threads : {0}\n", allocatedThreads < 0 ? "not applicable" : allocatedThreads.ToString()); + sb.AppendFormat("In use threads : {0}\n", inUseThreads); + sb.AppendFormat("Work items waiting : {0}\n", waitingCallbacks < 0 ? "not available" : waitingCallbacks.ToString()); + } + else + { + sb.AppendFormat("Thread pool not used\n"); + } + + return sb.ToString(); + } + + public static bool ValidateServerCertificate( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + if (m_NoVerifyCertChain) + sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateChainErrors; + + if (m_NoVerifyCertHostname) + sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateNameMismatch; + + if (sslPolicyErrors == SslPolicyErrors.None) + return true; + + return false; + } + + public string GetVersionText() + { + return String.Format("Version: {0} (SIMULATION/{1} - SIMULATION/{2})", + Version, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax); + } + + public virtual void HandleShow(string module, string[] cmd) + { + if (cmd.Length < 2) + return; + + switch (cmd[1]) + { + case "info": + ShowInfo(); + break; + + case "version": + Notice(GetVersionText()); + break; + + case "uptime": + Notice(GetUptimeReport()); + break; + + case "threads": + Notice(GetThreadsReport()); + break; + } + } + + public virtual void HandleThreadsAbort(string module, string[] cmd) + { + if (cmd.Length != 3) + { + MainConsole.Instance.Output("Usage: threads abort "); + return; + } + + int threadId; + if (!int.TryParse(cmd[2], out threadId)) + { + MainConsole.Instance.Output("ERROR: Thread id must be an integer"); + return; + } + + if (Watchdog.AbortThread(threadId)) + MainConsole.Instance.Output("Aborted thread with id {0}", threadId); + else + MainConsole.Instance.Output("ERROR - Thread with id {0} not found in managed threads", threadId); + } + + /// + /// Log information about the circumstances in which we're running (OpenSimulator version number, CLR details, + /// etc.). + /// + public void LogEnvironmentInformation() + { + m_logger.LogInformation($"Starting in {m_startupDirectory}"); + m_logger.LogInformation($"OpenSimulator version: {Version}"); + + m_logger.LogInformation($"Virtual machine runtime version: {Environment.Version}"); + m_logger.LogInformation( + $"Operating system version: {Environment.OSVersion}, " + + $".NET platform {Util.RuntimePlatformStr}, " + + $"{(Environment.Is64BitProcess ? "64" : "32")}-bit"); + } + + /// + /// Register common commands once m_console has been set if it is going to be set + /// + public void RegisterCommonCommands() + { + if (m_console == null) + return; + + m_console.Commands.AddCommand( + "General", false, "show info", "show info", "Show general information about the server", HandleShow); + + m_console.Commands.AddCommand( + "General", false, "show version", "show version", "Show server version", HandleShow); + + m_console.Commands.AddCommand( + "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); + + m_console.Commands.AddCommand( + "General", false, "command-script", + "command-script