diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 1ae12a24bd..940713b17c 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -82,8 +82,8 @@ namespace OpenSim.Framework.Servers m_osSecret = UUID.Random().ToString(); } - private static bool m_NoVerifyCertChain = false; - private static bool m_NoVerifyCertHostname = false; + private static bool m_NoVerifyCertChain = true; + private static bool m_NoVerifyCertHostname = true; public static bool ValidateServerCertificate( object sender, diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs index 2a3fb37dfb..8ca7cde52b 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs @@ -71,8 +71,9 @@ namespace OSHttpServer /// if no item was found. public HttpInputItem this[string name] { - get { - return _items.ContainsKey(name) ? _items[name] : Empty; + get + { + return _items.TryGetValue(name, out HttpInputItem hii) ? hii : Empty; } } @@ -144,7 +145,7 @@ namespace OSHttpServer /// true if the sub-item exists and has a value; otherwise false. public bool Contains(string name) { - return _items.ContainsKey(name) && _items[name].Value != null; + return _items.TryGetValue(name, out HttpInputItem hii) && hii.Value != null; } /// Returns a formatted representation of the instance with the values of all contained parameters @@ -216,7 +217,7 @@ namespace OSHttpServer { get { - return _items.ContainsKey(name) ? _items[name] : Empty; + return _items.TryGetValue(name, out HttpInputItem hii) ? hii : Empty; } } diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs index 388598e363..159f9c504a 100644 --- a/OpenSim/Region/Framework/Scenes/GodController.cs +++ b/OpenSim/Region/Framework/Scenes/GodController.cs @@ -240,9 +240,8 @@ namespace OpenSim.Region.Framework.Scenes if(state != null) { OSDMap s = (OSDMap)state; - - if (s.ContainsKey("ViewerUiIsGod")) - newstate = s["ViewerUiIsGod"].AsBoolean(); + if (s.TryGetValue("ViewerUiIsGod", out OSD tmp)) + newstate = tmp.AsBoolean(); m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default } UpdateGodLevels(newstate); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0b3134a7f6..d53bb8d653 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -833,9 +833,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Math.Tan(f); } - public LSL_Float llAtan2(LSL_Float x, LSL_Float y) + public LSL_Float llAtan2(LSL_Float y, LSL_Float x) { - return Math.Atan2(x, y); + return Math.Atan2(y, x); } public LSL_Float llSqrt(double f) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index fb6f2c58ff..325f342e0e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -43,7 +43,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces { void state(string newState); + //ApiDesc Returns absolute version as val (ie as postive value) LSL_Integer llAbs(LSL_Integer val); + //ApiDesc Returns cosine of val (val in radians) LSL_Float llAcos(LSL_Float val); //ApiDesc Sleep 0.1 void llAddToLandBanList(LSL_Key avatarId, LSL_Float hours); @@ -55,8 +57,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b); void llApplyImpulse(LSL_Vector force, LSL_Integer local); void llApplyRotationalImpulse(LSL_Vector force, int local); + //ApiDesc Returns sine of val (val in radians) LSL_Float llAsin(LSL_Float val); - LSL_Float llAtan2(LSL_Float x, LSL_Float y); + //ApiDesc Returns the angle whose tangent is the y/x + LSL_Float llAtan2(LSL_Float y, LSL_Float x); void llAttachToAvatar(LSL_Integer attachment); void llAttachToAvatarTemp(LSL_Integer attachmentPoint); LSL_Key llAvatarOnSitTarget(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index ccda2911f4..41effdfec5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -123,9 +123,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public LSL_Float llAtan2(LSL_Float x, LSL_Float y) + public LSL_Float llAtan2(LSL_Float y, LSL_Float x) { - return m_LSL_Functions.llAtan2(x, y); + return m_LSL_Functions.llAtan2(y, x); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index c0984281a9..1e5874ecec 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -101,9 +101,7 @@ namespace OpenSim.Server ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; - - WebUtil.SetupHTTPClients(m_NoVerifyCertChain, m_NoVerifyCertHostname, null, 32); - + m_Server = new HttpServerBase("R.O.B.U.S.T.", args); string registryLocation; @@ -121,6 +119,7 @@ namespace OpenSim.Server m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain); m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname); + WebUtil.SetupHTTPClients(m_NoVerifyCertChain, m_NoVerifyCertHostname, null, 32); string connList = serverConfig.GetString("ServiceConnectors", string.Empty); diff --git a/README.md b/README.md index dc711787d0..4799481e40 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,17 @@ To run OpenSim from a command prompt # Running OpenSim on Linux/Mac -You will need dotnet 6.0 runtime for linux or Mac (https://dotnet.microsoft.com/en-us/download/dotnet/6.0) +You will need + * [dotnet 6.0 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) + * libgdiplus + + if you have mono 6.x complete, you already have libgdiplus, otherwise you need to install it + using a package manager for your operating system, like apt, brew, macports, etc + for example on debian: + + `apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev` + To run OpenSim, from the unpacked distribution type: * cd bin diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs index d7a6a9fbc4..40708bc6d4 100644 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs +++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs @@ -799,21 +799,21 @@ namespace Amib.Threading /// public void Shutdown() { - Shutdown(true, 0); + Shutdown(0); } /// /// Force the SmartThreadPool to shutdown with timeout /// - public void Shutdown(bool forceAbort, TimeSpan timeout) + public void Shutdown(TimeSpan timeout) { - Shutdown(forceAbort, (int)timeout.TotalMilliseconds); + Shutdown((int)timeout.TotalMilliseconds); } /// /// Empties the queue of work items and abort the threads in the pool. /// - public void Shutdown(bool forceAbort, int millisecondsTimeout) + public void Shutdown(int millisecondsTimeout) { ValidateNotDisposed(); @@ -835,69 +835,41 @@ namespace Amib.Threading int millisecondsLeft = millisecondsTimeout; Stopwatch stopwatch = Stopwatch.StartNew(); - //DateTime start = DateTime.UtcNow; - bool waitInfinitely = (Timeout.Infinite == millisecondsTimeout); - bool timeout = false; - - // Each iteration we update the time left for the timeout. - foreach (ThreadEntry te in threadEntries) + if (millisecondsLeft >= Timeout.Infinite) { - if (te is null) - continue; - - Thread thread = te.WorkThread; - - // Join don't work with negative numbers - if (!waitInfinitely && (millisecondsLeft < 0)) - { - timeout = true; - break; - } - - // Wait for the thread to terminate - bool success = thread.Join(millisecondsLeft); - if (!success) - { - timeout = true; - break; - } - - if (!waitInfinitely) - { - // Update the time left to wait - //TimeSpan ts = DateTime.UtcNow - start; - millisecondsLeft = millisecondsTimeout - (int)stopwatch.ElapsedMilliseconds; - } - te.WorkThread = null; - } - - if (timeout && forceAbort) - { - // Abort the threads in the pool foreach (ThreadEntry te in threadEntries) { if (te is null) continue; Thread thread = te.WorkThread; - if (thread is not null && thread.IsAlive ) + if(thread is null) + continue; + + if (thread.IsAlive) { - try + // Wait for the thread to terminate + _ = thread.Join(millisecondsLeft); + + if (millisecondsLeft > 0) { - //thread.Abort(); // Shutdown - te.WorkThread = null; - } - catch (SecurityException e) - { - e.GetHashCode(); - } - catch (ThreadStateException ex) - { - ex.GetHashCode(); - // In case the thread has been terminated - // after the check if it is alive. + // Update the time left to wait + millisecondsLeft = millisecondsTimeout - (int)stopwatch.ElapsedMilliseconds; + if (millisecondsLeft < 0) + millisecondsLeft= 0; } } + te.WorkThread = null; + } + } + else + { + // there is no Abort in dotnet > 5, so we can't do anything + foreach (ThreadEntry te in threadEntries) + { + if (te is null) + continue; + te.WorkThread = null; } } } diff --git a/bin/CSJ2K.dll b/bin/CSJ2K.dll index 88347fc3aa..896e874001 100755 Binary files a/bin/CSJ2K.dll and b/bin/CSJ2K.dll differ