From 16fa47e4d311bbeff404256fe3cee1d7a414a461 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Apr 2024 14:30:02 +0100 Subject: [PATCH 01/12] lludp replace BeginReceiveFrom/AsyncEndReceive --- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 139 ++++++------------ 1 file changed, 43 insertions(+), 96 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 74593d9a527..ea754ef9df7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -32,6 +32,8 @@ using OpenSim.Framework; using OpenMetaverse; using OpenMetaverse.Packets; +using System.Threading; +using System.Threading.Tasks; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -72,6 +74,8 @@ public abstract class OpenSimUDPBase /// Returns true if the server is currently listening for inbound packets, otherwise false public bool IsRunningInbound { get; private set; } + public CancellationTokenSource InboundCancellationSource = new(); + /// Returns true if the server is currently sending outbound packets, otherwise false /// If IsRunningOut = false, then any request to send a packet is simply dropped. @@ -240,10 +244,8 @@ public virtual void StartInbound(int recvBufferSize) IsRunningInbound = true; - // kick off an async receive. The Start() method will return, the - // actual receives will occur asynchronously and will be caught in - // AsyncEndRecieve(). - AsyncBeginReceive(); + // kick start the receiver tasks dance. + Task.Run(AsyncBeginReceive); } } @@ -264,6 +266,7 @@ public virtual void StopInbound() m_log.DebugFormat("[UDPBASE]: Stopping inbound UDP loop"); IsRunningInbound = false; + InboundCancellationSource.Cancel(); m_udpSocket.Close(); m_udpSocket = null; } @@ -276,119 +279,63 @@ public virtual void StopOutbound() IsRunningOutbound = false; } - private void AsyncBeginReceive() + private static IPEndPoint dummyIP = new IPEndPoint(IPAddress.Any, 0); + private static readonly ExpiringCacheOS IPEndpointsCache = new(300000); + + private async void AsyncBeginReceive() { + SocketAddress workSktAddress = new(m_udpSocket.AddressFamily); while (IsRunningInbound) { - UDPPacketBuffer buf = GetNewUDPBuffer(new IPEndPoint(IPAddress.Any, 0)); // we need a fresh one here, for now at least + UDPPacketBuffer buf = GetNewUDPBuffer(null); // we need a fresh one here, for now at least try { - // kick off an async read - IAsyncResult iar = m_udpSocket.BeginReceiveFrom( - buf.Data, - 0, - buf.Data.Length, - SocketFlags.None, - ref buf.RemoteEndPoint, - AsyncEndReceive, - buf); - - if (!iar.CompletedSynchronously) + int nbytes = await m_udpSocket.ReceiveFromAsync(buf.Data.AsMemory(), SocketFlags.None, workSktAddress, InboundCancellationSource.Token); + if (!IsRunningInbound) + { + FreeUDPBuffer(buf); return; - } - catch (SocketException e) - { - if (e.SocketErrorCode == SocketError.ConnectionReset) + } + + if (nbytes > 0) { - m_log.Warn("[UDPBASE]: SIO_UDP_CONNRESET was ignored, attempting to salvage the UDP listener on port " + m_udpPort); + int startTick = Util.EnvironmentTickCount(); + if(!IPEndpointsCache.TryGetValue(workSktAddress, 300000, out EndPoint ep)) { - try - { - IAsyncResult iar = m_udpSocket.BeginReceiveFrom( - buf.Data, - 0, - buf.Data.Length, - SocketFlags.None, - ref buf.RemoteEndPoint, - AsyncEndReceive, - buf); - - if (!iar.CompletedSynchronously) - return; - } - catch (SocketException) { } - catch (ObjectDisposedException) { return; } + ep = dummyIP.Create(workSktAddress); + IPEndpointsCache.AddOrUpdate(workSktAddress, ep, 300000); } - m_log.Warn("[UDPBASE]: Salvaged the UDP listener on port " + m_udpPort); - } - } - catch (Exception e) - { - m_log.Error( - string.Format("[UDPBASE]: Error processing UDP begin receive {0}. Exception ", UdpReceives), e); - } - } - } - private void AsyncEndReceive(IAsyncResult iar) - { - if (IsRunningInbound) - { - bool sync = iar.CompletedSynchronously; - try - { - // get the buffer that was created in AsyncBeginReceive - // this is the received data - UDPPacketBuffer buffer = (UDPPacketBuffer)iar.AsyncState; - - int startTick = Util.EnvironmentTickCount(); + buf.RemoteEndPoint = ep; - // get the length of data actually read from the socket, store it with the - // buffer - buffer.DataLength = m_udpSocket.EndReceiveFrom(iar, ref buffer.RemoteEndPoint); + buf.DataLength = nbytes; + UdpReceives++; + PacketReceived(buf); - UdpReceives++; - - // call the abstract method PacketReceived(), passing the buffer that - // has just been filled from the socket read. - PacketReceived(buffer); - - // If more than one thread can be calling AsyncEndReceive() at once (e.g. if m_asyncPacketHandler) - // then a particular stat may be inaccurate due to a race condition. We won't worry about this - // since this should be rare and won't cause a runtime problem. - if (m_currentReceiveTimeSamples >= s_receiveTimeSamples) - { - AverageReceiveTicksForLastSamplePeriod - = (float)m_receiveTicksInCurrentSamplePeriod / s_receiveTimeSamples; + if (m_currentReceiveTimeSamples >= s_receiveTimeSamples) + { + AverageReceiveTicksForLastSamplePeriod + = (float)m_receiveTicksInCurrentSamplePeriod / s_receiveTimeSamples; - m_receiveTicksInCurrentSamplePeriod = 0; - m_currentReceiveTimeSamples = 0; + m_receiveTicksInCurrentSamplePeriod = 0; + m_currentReceiveTimeSamples = 0; + } + else + { + m_receiveTicksInCurrentSamplePeriod += Util.EnvironmentTickCountSubtract(startTick); + m_currentReceiveTimeSamples++; + } } else - { - m_receiveTicksInCurrentSamplePeriod += Util.EnvironmentTickCountSubtract(startTick); - m_currentReceiveTimeSamples++; - } + FreeUDPBuffer(buf); } - catch (SocketException se) + catch (OperationCanceledException) { - m_log.Error( - string.Format( - "[UDPBASE]: Error processing UDP end receive {0}, socket error code {1}. Exception ", - UdpReceives, se.ErrorCode), - se); } - catch(ObjectDisposedException) { } catch (Exception e) { - m_log.Error( - string.Format("[UDPBASE]: Error processing UDP end receive {0}. Exception ", UdpReceives), e); - } - finally - { - if (IsRunningInbound && !sync) - AsyncBeginReceive(); + m_log.Error($"[UDPBASE]: Error processing UDP receiveFrom. Exception ", e); } } } From 8e6eeb193158d9b2b61f01a8c13a546e52712784 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Apr 2024 15:47:33 +0100 Subject: [PATCH 02/12] let the socketAddress cache be global --- OpenSim/Framework/Util.cs | 22 ++++++++++++++----- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 11 +--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index aa5755661c8..bc4b00f3ee1 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1617,7 +1617,21 @@ public static string FieldToString(byte[] bytes, string fieldName) return output.ToString(); } - private static readonly ExpiringCacheOS dnscache = new(10000); + private static IPEndPoint dummyIPEndPoint = new IPEndPoint(IPAddress.Any, 0); + private static readonly ExpiringCacheOS dnscache = new(30000); + private static readonly ExpiringCacheOS EndpointsCache = new(300000); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static EndPoint GetEndPoint(SocketAddress sckaddr) + { + if (!EndpointsCache.TryGetValue(sckaddr, 300000, out EndPoint ep)) + { + ep = dummyIPEndPoint.Create(sckaddr); + EndpointsCache.AddOrUpdate(sckaddr, ep, 300); + } + return ep; + } + /// /// Converts a URL to a IPAddress @@ -1686,16 +1700,14 @@ public static IPEndPoint getEndPoint(IPAddress ia, int port) if (ia == null) return null; - IPEndPoint newEP; try { - newEP = new IPEndPoint(ia, port); + return new IPEndPoint(ia, port); } catch { - newEP = null; + return null; } - return newEP; } public static IPEndPoint getEndPoint(string hostname, int port) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index ea754ef9df7..51f438a7c01 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -279,9 +279,6 @@ public virtual void StopOutbound() IsRunningOutbound = false; } - private static IPEndPoint dummyIP = new IPEndPoint(IPAddress.Any, 0); - private static readonly ExpiringCacheOS IPEndpointsCache = new(300000); - private async void AsyncBeginReceive() { SocketAddress workSktAddress = new(m_udpSocket.AddressFamily); @@ -300,14 +297,8 @@ private async void AsyncBeginReceive() if (nbytes > 0) { int startTick = Util.EnvironmentTickCount(); - if(!IPEndpointsCache.TryGetValue(workSktAddress, 300000, out EndPoint ep)) - { - ep = dummyIP.Create(workSktAddress); - IPEndpointsCache.AddOrUpdate(workSktAddress, ep, 300000); - } - - buf.RemoteEndPoint = ep; + buf.RemoteEndPoint = Util.GetEndPoint(workSktAddress);; buf.DataLength = nbytes; UdpReceives++; From 620859c10e54322dbf347d517cad26a51ed79118 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Apr 2024 17:03:52 +0100 Subject: [PATCH 03/12] replace stream.beginread --- .../OSHttpServer/HttpClientContext.cs | 86 ++++++++----------- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 5 +- 2 files changed, 40 insertions(+), 51 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs index 5d5682fefc9..c3f8680e7b0 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs @@ -208,14 +208,7 @@ private void OnRequestLine(object sender, RequestLineEventArgs e) /// public virtual void Start() { - try - { - m_stream.BeginRead(m_ReceiveBuffer, 0, m_ReceiveBuffer.Length, OnReceive, null); - } - catch (Exception err) - { - LogWriter.Write(this, LogPrio.Debug, err.ToString()); - } + Task.Run(ReceiveLoop).ConfigureAwait(false); } /// @@ -348,63 +341,58 @@ public void Disconnect(SocketError error) } } - private void OnReceive(IAsyncResult ar) + private async void ReceiveLoop() { try { - int bytesRead = 0; - if (m_stream is null) - return; - try - { - bytesRead = m_stream.EndRead(ar); - } - catch (NullReferenceException) + while (true) { - Disconnect(SocketError.ConnectionReset); - return; - } + if (m_stream == null || !m_stream.CanRead) + return; - if (bytesRead == 0) - { - Disconnect(SocketError.Success); - return; - } + int bytesRead = + await m_stream.ReadAsync(m_ReceiveBuffer, m_ReceiveBytesLeft, m_ReceiveBuffer.Length - m_ReceiveBytesLeft).ConfigureAwait(false); - if (m_isClosing) - return; + if (bytesRead == 0) + { + Disconnect(SocketError.Success); + return; + } - m_ReceiveBytesLeft += bytesRead; + if (m_isClosing) + return; - int offset = m_parser.Parse(m_ReceiveBuffer, 0, m_ReceiveBytesLeft); - if (m_stream is null) - return; // "Connection: Close" in effect. + m_ReceiveBytesLeft += bytesRead; - if(offset > 0) - { - int nextBytesleft, nextOffset; - while ((nextBytesleft = m_ReceiveBytesLeft - offset) > 0) + int offset = m_parser.Parse(m_ReceiveBuffer, 0, m_ReceiveBytesLeft); + if (m_stream is null) + return; // "Connection: Close" in effect. + + if(offset > 0) { - nextOffset = m_parser.Parse(m_ReceiveBuffer, offset, nextBytesleft); + int nextBytesleft, nextOffset; + while ((nextBytesleft = m_ReceiveBytesLeft - offset) > 0) + { + nextOffset = m_parser.Parse(m_ReceiveBuffer, offset, nextBytesleft); - if (m_stream is null) - return; // "Connection: Close" in effect. + if (m_stream is null) + return; // "Connection: Close" in effect. - if (nextOffset == 0) - break; + if (nextOffset == 0) + break; - offset = nextOffset; + offset = nextOffset; + } } - } - // copy unused bytes to the beginning of the array - if (offset > 0 && m_ReceiveBytesLeft > offset) - Buffer.BlockCopy(m_ReceiveBuffer, offset, m_ReceiveBuffer, 0, m_ReceiveBytesLeft - offset); + // copy unused bytes to the beginning of the array + if (offset > 0 && m_ReceiveBytesLeft > offset) + Buffer.BlockCopy(m_ReceiveBuffer, offset, m_ReceiveBuffer, 0, m_ReceiveBytesLeft - offset); - m_ReceiveBytesLeft -= offset; - if (StreamPassedOff) - return; //? - m_stream.BeginRead(m_ReceiveBuffer, m_ReceiveBytesLeft, m_ReceiveBuffer.Length - m_ReceiveBytesLeft, OnReceive, null); + m_ReceiveBytesLeft -= offset; + if (StreamPassedOff) + return; //? + } } catch (BadRequestException err) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 51f438a7c01..58d25d66fa3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -245,7 +245,7 @@ public virtual void StartInbound(int recvBufferSize) IsRunningInbound = true; // kick start the receiver tasks dance. - Task.Run(AsyncBeginReceive); + Task.Run(AsyncBeginReceive).ConfigureAwait(false); } } @@ -287,7 +287,8 @@ private async void AsyncBeginReceive() UDPPacketBuffer buf = GetNewUDPBuffer(null); // we need a fresh one here, for now at least try { - int nbytes = await m_udpSocket.ReceiveFromAsync(buf.Data.AsMemory(), SocketFlags.None, workSktAddress, InboundCancellationSource.Token); + int nbytes = + await m_udpSocket.ReceiveFromAsync(buf.Data.AsMemory(), SocketFlags.None, workSktAddress, InboundCancellationSource.Token).ConfigureAwait(false); if (!IsRunningInbound) { FreeUDPBuffer(buf); From 943ea29419ad2abe84510974fe6a8c43b8b75523 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Apr 2024 17:06:07 +0100 Subject: [PATCH 04/12] missing c&p --- .../Servers/HttpServer/OSHttpServer/HttpClientContext.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs index c3f8680e7b0..70e7adfeaa0 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs @@ -9,6 +9,7 @@ using System.Net.Security; using System.Security.Cryptography.X509Certificates; using OpenMetaverse; +using System.Threading.Tasks; namespace OSHttpServer { From 034cf66dfeef65afec5837037de2dd177ca8ce4d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 Apr 2024 10:58:27 +0100 Subject: [PATCH 05/12] replace beginaccept --- OpenSim/Framework/ExpiringCacheOS.cs | 54 +++++++++ .../OSHttpServer/ContextTimeoutManager.cs | 2 +- .../HttpServer/OSHttpServer/HttpListener.cs | 105 +++++++----------- 3 files changed, 98 insertions(+), 63 deletions(-) diff --git a/OpenSim/Framework/ExpiringCacheOS.cs b/OpenSim/Framework/ExpiringCacheOS.cs index 00be73d1109..6f6de40b7a5 100644 --- a/OpenSim/Framework/ExpiringCacheOS.cs +++ b/OpenSim/Framework/ExpiringCacheOS.cs @@ -30,6 +30,7 @@ using System.Threading; using System.Collections.Generic; using Timer = System.Threading.Timer; +using System.Runtime.InteropServices; namespace OpenSim.Framework { @@ -460,6 +461,59 @@ public bool TryGetValue(TKey1 key, int expireMS, out TValue1 value) return success; } + public ref TValue1 TryGetOrDefaultValue(TKey1 key, out bool existed) + { + bool gotLock = false; + try + { + try { } + finally + { + m_rwLock.ExitUpgradeableReadLock(); + gotLock = true; + } + + return ref CollectionsMarshal.GetValueRefOrAddDefault(m_values, key, out existed); + } + finally + { + if (gotLock) + m_rwLock.ExitUpgradeableReadLock(); + } + } + + public ref TValue1 TryGetOrDefaultValue(TKey1 key, int expireMS, out bool existed) + { + bool gotLock = false; + try + { + try { } + finally + { + m_rwLock.EnterWriteLock(); + gotLock = true; + } + + ref TValue1 ret = ref CollectionsMarshal.GetValueRefOrAddDefault(m_values, key, out existed); + int now; + if (expireMS > 0) + { + expireMS = (expireMS > m_expire) ? expireMS : m_expire; + now = (int)(Util.GetTimeStampMS() - m_startTS) + expireMS; + } + else + now = int.MinValue; + + m_expireControl[key] = now; + return ref ret; + } + finally + { + if (gotLock) + m_rwLock.EnterWriteLock(); + } + } + public TValue1[] Values { get diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs index dbf0c2d596d..bebe2fbb486 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/ContextTimeoutManager.cs @@ -322,7 +322,7 @@ public static void EnqueueSend(HttpClientContext context, int priority) default: return; } - m_processWaitEven.Set(); + m_processWaitEven?.Set(); } public static void PulseWaitSend() diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpListener.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpListener.cs index af9f9ea622b..4be06324c1d 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpListener.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpListener.cs @@ -5,6 +5,8 @@ using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Threading; +using System.Threading.Tasks; +using System.Runtime.CompilerServices; namespace OSHttpServer { @@ -19,8 +21,8 @@ public class OSHttpListener: IDisposable private TcpListener m_listener; private ILogWriter m_logWriter = NullLogWriter.Instance; - private int m_pendingAccepts; private bool m_shutdown; + public readonly CancellationTokenSource m_CancellationSource = new(); protected RemoteCertificateValidationCallback m_clientCertValCallback = null; public event EventHandler Accepted; @@ -86,6 +88,7 @@ public static OSHttpListener Create(IPAddress address, int port, X509Certificate return new OSHttpListener(address, port, certificate, protocols); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private void OnRequestReceived(object sender, RequestEventArgs e) { RequestReceived?.Invoke(sender, e); @@ -120,76 +123,53 @@ public ILogWriter LogWriter /// public bool UseTraceLogs { get; set; } - - /// Exception. - private void OnAccept(IAsyncResult ar) + private async void AcceptLoop() { - bool beginAcceptCalled = false; try { - int count = Interlocked.Decrement(ref m_pendingAccepts); - if (m_shutdown) + while (true) { - if (count == 0) + if (m_shutdown) + { m_shutdownEvent.Set(); - return; - } - - Interlocked.Increment(ref m_pendingAccepts); - m_listener.BeginAcceptSocket(OnAccept, null); - beginAcceptCalled = true; - Socket socket = m_listener.EndAcceptSocket(ar); - if (!socket.Connected) - { - socket.Dispose(); - return; - } - - socket.NoDelay = true; - - if (!OnAcceptingSocket(socket)) - { - socket.Disconnect(true); - return; - } - - if(socket.Connected) - { - m_logWriter.Write(this, LogPrio.Debug, $"Accepted connection from: {socket.RemoteEndPoint}"); - - if (m_certificate is not null) - m_contextFactory.CreateSecureContext(socket, m_certificate, m_sslProtocols, m_clientCertValCallback); + break; + } + + Socket socket = await m_listener.AcceptSocketAsync(m_CancellationSource.Token).ConfigureAwait(false); ; + if (!socket.Connected) + { + socket.Dispose(); + continue; + } + + socket.NoDelay = true; + + if (!OnAcceptingSocket(socket)) + { + socket.Disconnect(true); + continue; + } + if (socket.Connected) + { + m_logWriter.Write(this, LogPrio.Debug, $"Accepted connection from: {socket.RemoteEndPoint}"); + + if (m_certificate is not null) + m_contextFactory.CreateSecureContext(socket, m_certificate, m_sslProtocols, m_clientCertValCallback); + else + m_contextFactory.CreateContext(socket); + } else - m_contextFactory.CreateContext(socket); + socket.Dispose(); } - else - socket.Dispose(); } - catch (Exception err) + catch (OperationCanceledException) { - m_logWriter.Write(this, LogPrio.Debug, err.Message); - ExceptionThrown?.Invoke(this, err); - - if (!beginAcceptCalled) - RetryBeginAccept(); - } - } - - /// - /// Will try to accept connections one more time. - /// - /// If any exceptions is thrown. - private void RetryBeginAccept() - { - try - { - m_logWriter.Write(this, LogPrio.Error, "Trying to accept connections again."); - m_listener.BeginAcceptSocket(OnAccept, null); + m_shutdownEvent.Set(); } catch (Exception err) { - m_logWriter.Write(this, LogPrio.Fatal, err.Message); - ExceptionThrown?.Invoke(this, err); + m_logWriter.Write(this, LogPrio.Debug, err.Message); + ExceptionThrown?.Invoke(this, err); } } @@ -221,8 +201,7 @@ public void Start(int backlog) m_listener = new TcpListener(m_address, m_port); m_listener.Start(backlog); - Interlocked.Increment(ref m_pendingAccepts); - m_listener.BeginAcceptSocket(OnAccept, null); + Task.Run(AcceptLoop).ConfigureAwait(false); } /// @@ -232,10 +211,11 @@ public void Start(int backlog) public void Stop() { m_shutdown = true; + m_CancellationSource.Cancel(); m_contextFactory.Shutdown(); - m_listener.Stop(); if (!m_shutdownEvent.WaitOne()) m_logWriter.Write(this, LogPrio.Error, "Failed to shutdown listener properly."); + m_listener.Stop(); m_listener = null; Dispose(); } @@ -251,6 +231,7 @@ protected void Dispose(bool disposing) if (m_shutdownEvent != null) { m_shutdownEvent.Dispose(); + m_CancellationSource.Dispose(); } } } From 020ddeef65ddbd73afe21532aabb3af86d271220 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 Apr 2024 12:51:31 +0100 Subject: [PATCH 06/12] preprocess logiin welcome msg --- .../LLLoginService/LLLoginResponse.cs | 29 +--------- .../Services/LLLoginService/LLLoginService.cs | 55 +++++++++++-------- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 9cb72cbd186..6729ceb9ff6 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -270,7 +270,6 @@ public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserI m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); FillOutSeedCap(aCircuit, destination, clientIP); - switch (DSTZone) { case "none": @@ -306,7 +305,6 @@ public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserI { DST = dstTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; } - break; } } @@ -406,30 +404,7 @@ private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, I private void SetDefaultValues() { - TimeZoneInfo gridTimeZone; - - // Disabled for now pending making timezone a config value, which can at some point have a default of - // a ; separated list of possible timezones. - // The problem here is that US/Pacific (or even the Olsen America/Los_Angeles) is not universal across - // windows, mac and various distributions of linux, introducing another element of consistency. - // The server operator needs to be able to control this setting -// try -// { -// // First try to fetch DST from Pacific Standard Time, because this is -// // the one expected by the viewer. "US/Pacific" is the string to search -// // on linux and mac, and should work also on Windows (to confirm) -// gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific"); -// } -// catch (Exception e) -// { -// m_log.WarnFormat( -// "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", -// e.Message); - - gridTimeZone = TimeZoneInfo.Local; -// } - - DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; + DST = "N"; StipendSinceLogin = "N"; Gendered = "Y"; @@ -494,7 +469,7 @@ private void SetDefaultValues() currency = String.Empty; ClassifiedFee = "0"; - MaxAgentGroups = 42; + MaxAgentGroups = Constants.MaxAgentGroups; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 173172ec41c..297c86eee48 100755 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -90,6 +90,7 @@ public class LLLoginService : ILoginService protected string m_DeniedID0s; protected string m_MessageUrl; protected string m_DSTZone; + protected bool m_allowDuplicatePresences = false; protected string m_messageKey; protected bool m_allowLoginFallbackToAnyRegion = true; // if login requested region if not found and there are no Default or fallback regions, @@ -166,11 +167,32 @@ public LLLoginService(IConfigSource config, ISimulationService simService, ILibr m_DeniedID0s = Util.GetConfigVarFromSections(config, "DeniedID0s", accessControlConfigSections, string.Empty); m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); + m_WelcomeMessage = null; + if (!string.IsNullOrEmpty(m_MessageUrl)) + { + try + { + using (WebClient client = new()) + m_WelcomeMessage = client.DownloadString(m_MessageUrl); + } + catch + { + m_WelcomeMessage = null; + } + } + + if (string.IsNullOrEmpty(m_WelcomeMessage)) + m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); + + m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n"); + m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); + + m_MaxAgentGroups = Constants.MaxAgentGroups; IConfig groupConfig = config.Configs["Groups"]; if (groupConfig is not null) - m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); + m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", m_MaxAgentGroups); IConfig presenceConfig = config.Configs["PresenceService"]; if (presenceConfig is not null) @@ -193,10 +215,7 @@ public LLLoginService(IConfigSource config, ISimulationService simService, ILibr if (accountService.Length == 0 || authService.Length == 0) throw new Exception("LoginService is missing service specifications"); - // replace newlines in welcome message - m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n"); - - object[] args = new object[] { config }; + object[] args = [config]; m_UserAccountService = ServerUtils.LoadPlugin(accountService, args); m_GridUserService = ServerUtils.LoadPlugin(gridUserService, args); object[] authArgs = new object[] { config, m_UserAccountService }; @@ -478,7 +497,7 @@ public LoginResponse Login(string firstName, string lastName, string passwd, str m_HGInventoryService?.GetRootFolder(account.PrincipalID); List inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID); - if (m_RequireInventory && ((inventorySkel is null) || (inventorySkel is not null && inventorySkel.Count == 0))) + if (m_RequireInventory && inventorySkel is null || inventorySkel.Count == 0) { m_log.InfoFormat( "[LLOGIN SERVICE]: Login failed, for {0} {1}, reason: unable to retrieve user inventory", @@ -486,10 +505,6 @@ public LoginResponse Login(string firstName, string lastName, string passwd, str return LLFailedLoginResponse.InventoryProblem; } - // Get active gestures - List gestures = m_InventoryService.GetActiveGestures(account.PrincipalID); -// m_log.DebugFormat("[LLOGIN SERVICE]: {0} active gestures", gestures.Count); - // // Login the presence // @@ -599,22 +614,17 @@ public LoginResponse Login(string firstName, string lastName, string passwd, str if (m_FriendsService is not null) { friendsList = m_FriendsService.GetFriends(account.PrincipalID); -// m_log.DebugFormat("[LLOGIN SERVICE]: Retrieved {0} friends", friendsList.Length); + //m_log.DebugFormat("[LLOGIN SERVICE]: Retrieved {0} friends", friendsList.Length); } // // Finally, fill out the response and return it - // - if (m_MessageUrl != string.Empty) - { - using(WebClient client = new()) - processedMessage = client.DownloadString(m_MessageUrl); - } - else - { - processedMessage = m_WelcomeMessage; - } - processedMessage = processedMessage.Replace("\\n", "\n").Replace("", firstName + " " + lastName); + + processedMessage = m_WelcomeMessage.Replace("", firstName + " " + lastName); + + // Get active gestures + List gestures = m_InventoryService.GetActiveGestures(account.PrincipalID); + //m_log.DebugFormat("[LLOGIN SERVICE]: {0} active gestures", gestures.Count); LLLoginResponse response = new( account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, @@ -1157,6 +1167,7 @@ private void HandleLoginCommand(string module, string[] cmd) { m_WelcomeMessage = cmd[2]; MainConsole.Instance.Output("Login welcome message set to '{0}'", m_WelcomeMessage); + m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n"); } break; } From 2736d36391c324c9db1f9caef1700cf080f97222 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 Apr 2024 22:57:58 +0100 Subject: [PATCH 07/12] also do send terrain texture change also from viewer to viewers --- .../ClientStack/Linden/UDP/LLUDPServer.cs | 4 +- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 41 ++++++++++--------- .../World/Estate/EstateManagementModule.cs | 4 +- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 04bfe5b482c..4ce02236ba1 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1772,7 +1772,7 @@ protected void IncomingPacketHandler() // on to en-US to avoid number parsing issues Culture.SetCurrentCulture(); - while (IsRunningInbound) + while (m_IsRunningInbound) { Scene.ThreadAlive(1); try @@ -1818,7 +1818,7 @@ protected void OutgoingPacketHandler() // Action generic every round Action clientPacketHandler = ClientOutgoingPacketHandler; - while (base.IsRunningOutbound) + while (m_IsRunningOutbound) { Scene.ThreadAlive(2); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 58d25d66fa3..3bb475c8b1c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -73,13 +73,24 @@ public abstract class OpenSimUDPBase public static int m_udpBuffersPoolPtr = -1; /// Returns true if the server is currently listening for inbound packets, otherwise false - public bool IsRunningInbound { get; private set; } + internal bool m_IsRunningInbound; + public bool IsRunningInbound + { + get { return m_IsRunningInbound; } + private set { m_IsRunningInbound = value; } + } + public CancellationTokenSource InboundCancellationSource = new(); /// Returns true if the server is currently sending outbound packets, otherwise false /// If IsRunningOut = false, then any request to send a packet is simply dropped. - public bool IsRunningOutbound { get; private set; } + internal bool m_IsRunningOutbound; + public bool IsRunningOutbound + { + get { return m_IsRunningOutbound; } + private set { m_IsRunningOutbound = value; } + } /// /// Number of UDP receives. @@ -179,19 +190,11 @@ public static void FreeUDPBuffer(UDPPacketBuffer buf) /// the UDP socket. This value is passed up to the operating system /// and used in the system networking stack. Use zero to leave this /// value as the default - /// Set this to true to start - /// receiving more packets while current packet handler callbacks are - /// still running. Setting this to false will complete each packet - /// callback before the next packet is processed - /// This method will attempt to set the SIO_UDP_CONNRESET flag - /// on the socket to get newer versions of Windows to behave in a sane - /// manner (not throwing an exception when the remote side resets the - /// connection). This call is ignored on Mono where the flag is not - /// necessary + public virtual void StartInbound(int recvBufferSize) { - if (!IsRunningInbound) + if (!m_IsRunningInbound) { m_log.DebugFormat("[UDPBASE]: Starting inbound UDP loop"); @@ -242,7 +245,7 @@ public virtual void StartInbound(int recvBufferSize) if (m_udpPort == 0) m_udpPort = ((IPEndPoint)m_udpSocket.LocalEndPoint).Port; - IsRunningInbound = true; + m_IsRunningInbound = true; // kick start the receiver tasks dance. Task.Run(AsyncBeginReceive).ConfigureAwait(false); @@ -256,16 +259,16 @@ public virtual void StartOutbound() { m_log.DebugFormat("[UDPBASE]: Starting outbound UDP loop"); - IsRunningOutbound = true; + m_IsRunningOutbound = true; } public virtual void StopInbound() { - if (IsRunningInbound) + if (m_IsRunningInbound) { m_log.DebugFormat("[UDPBASE]: Stopping inbound UDP loop"); - IsRunningInbound = false; + m_IsRunningInbound = false; InboundCancellationSource.Cancel(); m_udpSocket.Close(); m_udpSocket = null; @@ -276,20 +279,20 @@ public virtual void StopOutbound() { m_log.DebugFormat("[UDPBASE]: Stopping outbound UDP loop"); - IsRunningOutbound = false; + m_IsRunningOutbound = false; } private async void AsyncBeginReceive() { SocketAddress workSktAddress = new(m_udpSocket.AddressFamily); - while (IsRunningInbound) + while (m_IsRunningInbound) { UDPPacketBuffer buf = GetNewUDPBuffer(null); // we need a fresh one here, for now at least try { int nbytes = await m_udpSocket.ReceiveFromAsync(buf.Data.AsMemory(), SocketFlags.None, workSktAddress, InboundCancellationSource.Token).ConfigureAwait(false); - if (!IsRunningInbound) + if (!m_IsRunningInbound) { FreeUDPBuffer(buf); return; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 7b7287992c3..81395b0b910 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -229,7 +229,6 @@ public void TriggerRegionInfoChange() public void setEstateTerrainBaseTexture(int level, UUID texture) { SetEstateTerrainBaseTexture(null, level, texture); - sendRegionHandshakeToAll(); } public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) @@ -560,7 +559,7 @@ public void SetEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); - SendRegionInfoPacketToAll(); + sendRegionHandshakeToAll(); } public void SetEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) @@ -588,7 +587,6 @@ public void SetEstateTerrainTextureHeights(IClientAPI client, int corner, float Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionHandshakeToAll(); -// sendRegionInfoPacketToAll(); } private void HandleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) From 7c3e09f7d380f1be1fa612be734299420ad38050 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2024 23:17:20 +0100 Subject: [PATCH 08/12] cosmetics --- .../InstantMessage/HGMessageTransferModule.cs | 3 --- .../World/Estate/EstateManagementModule.cs | 4 ++++ .../HGInstantMessageService.cs | 2 +- .../Services/Interfaces/IPresenceService.cs | 18 +++++++++--------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index b188b747caa..23d79e50fc7 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs @@ -101,9 +101,6 @@ public virtual void AddRegion(Scene scene) public virtual void PostInitialise() { - if (!m_Enabled) - return; - } public virtual void RegionLoaded(Scene scene) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 81395b0b910..9a07d7f84b4 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -555,6 +555,8 @@ public void SetEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID case 3: Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; break; + default: + return; } Scene.RegionInfo.RegionSettings.Save(); @@ -582,6 +584,8 @@ public void SetEstateTerrainTextureHeights(IClientAPI client, int corner, float Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; break; + default: + return; } Scene.RegionInfo.RegionSettings.Save(); diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index b043174e698..b45b42d13ae 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -89,7 +89,7 @@ public HGInstantMessageService(IConfigSource config, IInstantMessageSimConnector if (string.IsNullOrEmpty(userAgentService)) m_log.WarnFormat("[HG IM SERVICE]: UserAgentService not set in [HGInstantMessageService]"); - object[] args = new object[] { config }; + object[] args = [ config ]; try { m_GridService = ServerUtils.LoadPlugin(gridService, args); diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index 90f98426f26..aa4d655725d 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs @@ -43,19 +43,19 @@ public PresenceInfo() public PresenceInfo(Dictionary kvp) { - if (kvp.ContainsKey("UserID")) - UserID = kvp["UserID"].ToString(); - if (kvp.ContainsKey("RegionID")) - UUID.TryParse(kvp["RegionID"].ToString(), out RegionID); + if (kvp.TryGetValue("UserID", out object ouid)) + UserID = ouid.ToString(); + if (kvp.TryGetValue("RegionID", out object orid)) + _ = UUID.TryParse(orid.ToString(), out RegionID); } public Dictionary ToKeyValuePairs() { - Dictionary result = new Dictionary(); - result["UserID"] = UserID; - result["RegionID"] = RegionID.ToString(); - - return result; + return new Dictionary + { + ["UserID"] = UserID, + ["RegionID"] = RegionID.ToString() + }; } } From c39fa1e7760f47e36677b761cdf2e8ca400bb955 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2024 23:31:03 +0100 Subject: [PATCH 09/12] mantis 9125: change yengine object file version to force recompiles; Wrap calls to some framework methods to reduce exagerated yobj dependencies on local runtime, like the ones reported. --- .../ScriptEngine/YEngine/MMRScriptBinOpStr.cs | 166 +++++++++++------- .../ScriptEngine/YEngine/MMRScriptCodeGen.cs | 81 ++++----- .../ScriptEngine/YEngine/MMRScriptInlines.cs | 4 +- 3 files changed, 149 insertions(+), 102 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptBinOpStr.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptBinOpStr.cs index 89f4ee3b33a..c5d3e951435 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptBinOpStr.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptBinOpStr.cs @@ -25,14 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using OpenSim.Region.ScriptEngine.Shared.ScriptBase; -using OpenSim.Region.ScriptEngine.Yengine; using System; using System.Collections.Generic; -using System.IO; using System.Reflection; using System.Reflection.Emit; -using System.Text; +using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using OpenSim.Region.ScriptEngine.Shared; @@ -83,48 +80,48 @@ public BinOpStr(Type outtype, BinOpStrEmitBO emitBO, bool rmwOK) private static TokenTypeStr tokenTypeStr = new TokenTypeStr(null); private static TokenTypeVec tokenTypeVec = new TokenTypeVec(null); - private static MethodInfo stringAddStringMethInfo = ScriptCodeGen.GetStaticMethod(typeof(string), "Concat", new Type[] { typeof(string), typeof(string) }); - private static MethodInfo stringCmpStringMethInfo = ScriptCodeGen.GetStaticMethod(typeof(string), "Compare", new Type[] { typeof(string), typeof(string), typeof(StringComparison) }); - - private static MethodInfo infoMethListAddFloat = GetBinOpsMethod("MethListAddFloat", new Type[] { typeof(LSL_List), typeof(double) }); - private static MethodInfo infoMethListAddInt = GetBinOpsMethod("MethListAddInt", new Type[] { typeof(LSL_List), typeof(int) }); - private static MethodInfo infoMethListAddKey = GetBinOpsMethod("MethListAddKey", new Type[] { typeof(LSL_List), typeof(string) }); - private static MethodInfo infoMethListAddRot = GetBinOpsMethod("MethListAddRot", new Type[] { typeof(LSL_List), typeof(LSL_Rotation) }); - private static MethodInfo infoMethListAddStr = GetBinOpsMethod("MethListAddStr", new Type[] { typeof(LSL_List), typeof(string) }); - private static MethodInfo infoMethListAddVec = GetBinOpsMethod("MethListAddVec", new Type[] { typeof(LSL_List), typeof(LSL_Vector) }); - private static MethodInfo infoMethListAddList = GetBinOpsMethod("MethListAddList", new Type[] { typeof(LSL_List), typeof(LSL_List) }); - private static MethodInfo infoMethFloatAddList = GetBinOpsMethod("MethFloatAddList", new Type[] { typeof(double), typeof(LSL_List) }); - private static MethodInfo infoMethIntAddList = GetBinOpsMethod("MethIntAddList", new Type[] { typeof(int), typeof(LSL_List) }); - private static MethodInfo infoMethKeyAddList = GetBinOpsMethod("MethKeyAddList", new Type[] { typeof(string), typeof(LSL_List) }); - private static MethodInfo infoMethRotAddList = GetBinOpsMethod("MethRotAddList", new Type[] { typeof(LSL_Rotation), typeof(LSL_List) }); - private static MethodInfo infoMethStrAddList = GetBinOpsMethod("MethStrAddList", new Type[] { typeof(string), typeof(LSL_List) }); - private static MethodInfo infoMethVecAddList = GetBinOpsMethod("MethVecAddList", new Type[] { typeof(LSL_Vector), typeof(LSL_List) }); - private static MethodInfo infoMethListEqList = GetBinOpsMethod("MethListEqList", new Type[] { typeof(LSL_List), typeof(LSL_List) }); - private static MethodInfo infoMethListNeList = GetBinOpsMethod("MethListNeList", new Type[] { typeof(LSL_List), typeof(LSL_List) }); - private static MethodInfo infoMethRotEqRot = GetBinOpsMethod("MethRotEqRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) }); - private static MethodInfo infoMethRotNeRot = GetBinOpsMethod("MethRotNeRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) }); - private static MethodInfo infoMethRotAddRot = GetBinOpsMethod("MethRotAddRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) }); - private static MethodInfo infoMethRotSubRot = GetBinOpsMethod("MethRotSubRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) }); - private static MethodInfo infoMethRotMulRot = GetBinOpsMethod("MethRotMulRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) }); - private static MethodInfo infoMethRotDivRot = GetBinOpsMethod("MethRotDivRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) }); - private static MethodInfo infoMethVecEqVec = GetBinOpsMethod("MethVecEqVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecNeVec = GetBinOpsMethod("MethVecNeVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecAddVec = GetBinOpsMethod("MethVecAddVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecSubVec = GetBinOpsMethod("MethVecSubVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecMulVec = GetBinOpsMethod("MethVecMulVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecModVec = GetBinOpsMethod("MethVecModVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecMulFloat = GetBinOpsMethod("MethVecMulFloat", new Type[] { typeof(LSL_Vector), typeof(double) }); - private static MethodInfo infoMethFloatMulVec = GetBinOpsMethod("MethFloatMulVec", new Type[] { typeof(double), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecDivFloat = GetBinOpsMethod("MethVecDivFloat", new Type[] { typeof(LSL_Vector), typeof(double) }); - private static MethodInfo infoMethVecMulInt = GetBinOpsMethod("MethVecMulInt", new Type[] { typeof(LSL_Vector), typeof(int) }); - private static MethodInfo infoMethIntMulVec = GetBinOpsMethod("MethIntMulVec", new Type[] { typeof(int), typeof(LSL_Vector) }); - private static MethodInfo infoMethVecDivInt = GetBinOpsMethod("MethVecDivInt", new Type[] { typeof(LSL_Vector), typeof(int) }); - private static MethodInfo infoMethVecMulRot = GetBinOpsMethod("MethVecMulRot", new Type[] { typeof(LSL_Vector), typeof(LSL_Rotation) }); - private static MethodInfo infoMethVecDivRot = GetBinOpsMethod("MethVecDivRot", new Type[] { typeof(LSL_Vector), typeof(LSL_Rotation) }); - private static MethodInfo infoMethDoubleDivDouble = GetBinOpsMethod("MethDoubleDivDouble", new Type[] { typeof(Double), typeof(Double) }); - private static MethodInfo infoMethLongDivLong = GetBinOpsMethod("MethLongDivLong", new Type[] { typeof(long), typeof(long) }); - private static MethodInfo infoMethDoubleModDouble = GetBinOpsMethod("MethDoubleModDouble", new Type[] { typeof(Double), typeof(Double) }); - private static MethodInfo infoMethLongModLong = GetBinOpsMethod("MethLongModLong", new Type[] { typeof(long), typeof(long) }); + private static MethodInfo stringAddStringMethInfo = GetBinOpsMethod("StringConcat", [typeof(string), typeof(string)]); + private static MethodInfo stringCmpStringMethInfo = GetBinOpsMethod("StringCompareOrdinal", [typeof(string), typeof(string)]); + + private static MethodInfo infoMethListAddFloat = GetBinOpsMethod("MethListAddFloat", [typeof(LSL_List), typeof(double)]); + private static MethodInfo infoMethListAddInt = GetBinOpsMethod("MethListAddInt", [typeof(LSL_List), typeof(int)]); + private static MethodInfo infoMethListAddKey = GetBinOpsMethod("MethListAddKey", [typeof(LSL_List), typeof(string)]); + private static MethodInfo infoMethListAddRot = GetBinOpsMethod("MethListAddRot", [typeof(LSL_List), typeof(LSL_Rotation)]); + private static MethodInfo infoMethListAddStr = GetBinOpsMethod("MethListAddStr", [typeof(LSL_List), typeof(string)]); + private static MethodInfo infoMethListAddVec = GetBinOpsMethod("MethListAddVec", [typeof(LSL_List), typeof(LSL_Vector)]); + private static MethodInfo infoMethListAddList = GetBinOpsMethod("MethListAddList", [typeof(LSL_List), typeof(LSL_List)]); + private static MethodInfo infoMethFloatAddList = GetBinOpsMethod("MethFloatAddList", [typeof(double), typeof(LSL_List)]); + private static MethodInfo infoMethIntAddList = GetBinOpsMethod("MethIntAddList", [typeof(int), typeof(LSL_List)]); + private static MethodInfo infoMethKeyAddList = GetBinOpsMethod("MethKeyAddList", [typeof(string), typeof(LSL_List)]); + private static MethodInfo infoMethRotAddList = GetBinOpsMethod("MethRotAddList", [typeof(LSL_Rotation), typeof(LSL_List)]); + private static MethodInfo infoMethStrAddList = GetBinOpsMethod("MethStrAddList", [typeof(string), typeof(LSL_List)]); + private static MethodInfo infoMethVecAddList = GetBinOpsMethod("MethVecAddList", [typeof(LSL_Vector), typeof(LSL_List)]); + private static MethodInfo infoMethListEqList = GetBinOpsMethod("MethListEqList", [typeof(LSL_List), typeof(LSL_List)]); + private static MethodInfo infoMethListNeList = GetBinOpsMethod("MethListNeList", [typeof(LSL_List), typeof(LSL_List)]); + private static MethodInfo infoMethRotEqRot = GetBinOpsMethod("MethRotEqRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]); + private static MethodInfo infoMethRotNeRot = GetBinOpsMethod("MethRotNeRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]); + private static MethodInfo infoMethRotAddRot = GetBinOpsMethod("MethRotAddRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]); + private static MethodInfo infoMethRotSubRot = GetBinOpsMethod("MethRotSubRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]); + private static MethodInfo infoMethRotMulRot = GetBinOpsMethod("MethRotMulRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]); + private static MethodInfo infoMethRotDivRot = GetBinOpsMethod("MethRotDivRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]); + private static MethodInfo infoMethVecEqVec = GetBinOpsMethod("MethVecEqVec", [typeof(LSL_Vector), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecNeVec = GetBinOpsMethod("MethVecNeVec", [typeof(LSL_Vector), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecAddVec = GetBinOpsMethod("MethVecAddVec", [typeof(LSL_Vector), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecSubVec = GetBinOpsMethod("MethVecSubVec", [typeof(LSL_Vector), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecMulVec = GetBinOpsMethod("MethVecMulVec", [typeof(LSL_Vector), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecModVec = GetBinOpsMethod("MethVecModVec", [typeof(LSL_Vector), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecMulFloat = GetBinOpsMethod("MethVecMulFloat", [typeof(LSL_Vector), typeof(double)]); + private static MethodInfo infoMethFloatMulVec = GetBinOpsMethod("MethFloatMulVec", [typeof(double), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecDivFloat = GetBinOpsMethod("MethVecDivFloat", [typeof(LSL_Vector), typeof(double)]); + private static MethodInfo infoMethVecMulInt = GetBinOpsMethod("MethVecMulInt", [typeof(LSL_Vector), typeof(int)]); + private static MethodInfo infoMethIntMulVec = GetBinOpsMethod("MethIntMulVec", [typeof(int), typeof(LSL_Vector)]); + private static MethodInfo infoMethVecDivInt = GetBinOpsMethod("MethVecDivInt", [typeof(LSL_Vector), typeof(int)]); + private static MethodInfo infoMethVecMulRot = GetBinOpsMethod("MethVecMulRot", [typeof(LSL_Vector), typeof(LSL_Rotation)]); + private static MethodInfo infoMethVecDivRot = GetBinOpsMethod("MethVecDivRot", [typeof(LSL_Vector), typeof(LSL_Rotation)]); + private static MethodInfo infoMethDoubleDivDouble = GetBinOpsMethod("MethDoubleDivDouble", [typeof(double), typeof(double)]); + private static MethodInfo infoMethLongDivLong = GetBinOpsMethod("MethLongDivLong", [typeof(long), typeof(long)]); + private static MethodInfo infoMethDoubleModDouble = GetBinOpsMethod("MethDoubleModDouble", [typeof(double), typeof(double)]); + private static MethodInfo infoMethLongModLong = GetBinOpsMethod("MethLongModLong", [typeof(long), typeof(long)]); private static MethodInfo GetBinOpsMethod(string name, Type[] types) { @@ -144,7 +141,7 @@ private static Dictionary DefineBinOps() { Dictionary bos = new Dictionary(); - string[] booltypes = new string[] { "bool", "char", "float", "integer", "key", "list", "string" }; + string[] booltypes = ["bool", "char", "float", "integer", "key", "list", "string"]; /* * Get the && and || all out of the way... @@ -154,10 +151,8 @@ private static Dictionary DefineBinOps() { for(int j = 0; j < booltypes.Length; j++) { - bos.Add(booltypes[i] + "&&" + booltypes[j], - new BinOpStr(typeof(bool), BinOpStrAndAnd)); - bos.Add(booltypes[i] + "||" + booltypes[j], - new BinOpStr(typeof(bool), BinOpStrOrOr)); + bos.Add(booltypes[i] + "&&" + booltypes[j], new BinOpStr(typeof(bool), BinOpStrAndAnd)); + bos.Add(booltypes[i] + "||" + booltypes[j], new BinOpStr(typeof(bool), BinOpStrOrOr)); } } @@ -970,7 +965,6 @@ private static void BinOpStrKeyEqX(ScriptCodeGen scg, Token errorAt, CompValu le result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0); scg.ilGen.Emit(errorAt, OpCodes.Ceq); @@ -982,7 +976,6 @@ private static void BinOpStrKeyNeX(ScriptCodeGen scg, Token errorAt, CompValu le result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0); scg.ilGen.Emit(errorAt, OpCodes.Ceq); @@ -1185,7 +1178,6 @@ private static void BinOpStrStrEqStr(ScriptCodeGen scg, Token errorAt, CompValu result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0); scg.ilGen.Emit(errorAt, OpCodes.Ceq); @@ -1197,7 +1189,6 @@ private static void BinOpStrStrNeStr(ScriptCodeGen scg, Token errorAt, CompValu result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0); scg.ilGen.Emit(errorAt, OpCodes.Ceq); @@ -1211,7 +1202,6 @@ private static void BinOpStrStrLtStr(ScriptCodeGen scg, Token errorAt, CompValu result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0); scg.ilGen.Emit(errorAt, OpCodes.Clt); @@ -1223,7 +1213,6 @@ private static void BinOpStrStrLeStr(ScriptCodeGen scg, Token errorAt, CompValu result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_1); scg.ilGen.Emit(errorAt, OpCodes.Clt); @@ -1235,7 +1224,6 @@ private static void BinOpStrStrGtStr(ScriptCodeGen scg, Token errorAt, CompValu result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0); scg.ilGen.Emit(errorAt, OpCodes.Cgt); @@ -1247,7 +1235,6 @@ private static void BinOpStrStrGeStr(ScriptCodeGen scg, Token errorAt, CompValu result.PopPre(scg, errorAt); left.PushVal(scg, errorAt, tokenTypeStr); right.PushVal(scg, errorAt, tokenTypeStr); - scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo); scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_M1); scg.ilGen.Emit(errorAt, OpCodes.Cgt); @@ -1395,26 +1382,58 @@ private static void BinOpStrVecDivRot(ScriptCodeGen scg, Token errorAt, CompValu * Needed to pick up functionality defined by overloaded operators of LSL_ types. * They need to be marked public or runtime says they are inaccessible. */ + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string StringConcat(string str1, string str2) + { + return string.Concat(str1, str2); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string StringConcat(string str1, string str2, string str3) + { + return string.Concat(str1, str2, str3); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string StringConcat(string str1, string str2, string str3, string str4) + { + return string.Concat(str1, str2, str3, str4); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static int StringCompareOrdinal(string str1, string str2) + { + return string.Compare(str1, str2, StringComparison.Ordinal); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethListAddFloat(LSL_List left, double right) { return MethListAddObj(left, new LSL_Float(right)); } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethListAddInt(LSL_List left, int right) { return MethListAddObj(left, new LSL_Integer(right)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethListAddKey(LSL_List left, string right) { return MethListAddObj(left, new LSL_Key(right)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethListAddRot(LSL_List left, LSL_Rotation right) { return MethListAddObj(left, right); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethListAddStr(LSL_List left, string right) { return MethListAddObj(left, new LSL_String(right)); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethListAddVec(LSL_List left, LSL_Vector right) { return MethListAddObj(left, right); @@ -1438,26 +1457,32 @@ public static LSL_List MethListAddList(LSL_List left, LSL_List right) return new LSL_List(newarr); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethFloatAddList(double left, LSL_List right) { return MethObjAddList(new LSL_Float(left), right); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethIntAddList(int left, LSL_List right) { return MethObjAddList(new LSL_Integer(left), right); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethKeyAddList(string left, LSL_List right) { return MethObjAddList(new LSL_Key(left), right); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethRotAddList(LSL_Rotation left, LSL_List right) { return MethObjAddList(left, right); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethStrAddList(string left, LSL_List right) { return MethObjAddList(new LSL_String(left), right); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_List MethVecAddList(LSL_Vector left, LSL_List right) { return MethObjAddList(left, right); @@ -1471,6 +1496,7 @@ public static LSL_List MethObjAddList(object left, LSL_List right) return new LSL_List(newarr); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool MethListEqList(LSL_List left, LSL_List right) { return left == right; @@ -1478,6 +1504,7 @@ public static bool MethListEqList(LSL_List left, LSL_List right) // According to http://wiki.secondlife.com/wiki/LlGetListLength // jackassed LSL allows 'somelist != []' to get the length of a list + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int MethListNeList(LSL_List left, LSL_List right) { int leftlen = left.Length; @@ -1485,106 +1512,127 @@ public static int MethListNeList(LSL_List left, LSL_List right) return leftlen - ritelen; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool MethRotEqRot(LSL_Rotation left, LSL_Rotation right) { return left == right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool MethRotNeRot(LSL_Rotation left, LSL_Rotation right) { return left != right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Rotation MethRotAddRot(LSL_Rotation left, LSL_Rotation right) { return left + right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Rotation MethRotSubRot(LSL_Rotation left, LSL_Rotation right) { return left - right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Rotation MethRotMulRot(LSL_Rotation left, LSL_Rotation right) { return left * right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Rotation MethRotDivRot(LSL_Rotation left, LSL_Rotation right) { return left / right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool MethVecEqVec(LSL_Vector left, LSL_Vector right) { return left == right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool MethVecNeVec(LSL_Vector left, LSL_Vector right) { return left != right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecAddVec(LSL_Vector left, LSL_Vector right) { return left + right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecSubVec(LSL_Vector left, LSL_Vector right) { return left - right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double MethVecMulVec(LSL_Vector left, LSL_Vector right) { return (double)(left * right).value; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecModVec(LSL_Vector left, LSL_Vector right) { return left % right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecMulFloat(LSL_Vector left, double right) { return left * right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethFloatMulVec(double left, LSL_Vector right) { return left * right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecDivFloat(LSL_Vector left, double right) { return left / right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecMulInt(LSL_Vector left, int right) { return left * right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethIntMulVec(int left, LSL_Vector right) { return left * right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecDivInt(LSL_Vector left, int right) { return left / right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecMulRot(LSL_Vector left, LSL_Rotation right) { return left * right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static LSL_Vector MethVecDivRot(LSL_Vector left, LSL_Rotation right) { return left / right; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double MethDoubleDivDouble(double a, double b) { double r = a / b; diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs index f12494b0bfd..1a21a9572e1 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs @@ -65,7 +65,7 @@ public class ScriptCodeGen: IScriptCodeGen { public static readonly string OBJECT_CODE_MAGIC = "YObjectCode"; // reserve positive version values for original xmr - public static int COMPILED_VERSION_VALUE = -9; // decremented when compiler or object file changes + public static int COMPILED_VERSION_VALUE = -10; // decremented when compiler or object file changes public static readonly int CALL_FRAME_MEMUSE = 64; public static readonly int STRING_LEN_TO_MEMUSE = 2; @@ -85,21 +85,21 @@ public class ScriptCodeGen: IScriptCodeGen private static readonly TokenTypeRot tokenTypeRot = new(null); private static readonly TokenTypeStr tokenTypeStr = new(null); private static readonly TokenTypeVec tokenTypeVec = new(null); - private static readonly Type[] instanceTypeArg = new Type[] { typeof(XMRInstAbstract) }; - private static readonly string[] instanceNameArg = new string[] { "$xmrthis" }; - - private static readonly ConstructorInfo lslFloatConstructorInfo = typeof(LSL_Float).GetConstructor(new Type[] { typeof(double) }); - private static readonly ConstructorInfo lslIntegerConstructorInfo = typeof(LSL_Integer).GetConstructor(new Type[] { typeof(int) }); - private static readonly ConstructorInfo lslListConstructorInfo = typeof(LSL_List).GetConstructor(new Type[] { typeof(object[]) }); - public static readonly ConstructorInfo lslRotationConstructorInfo = typeof(LSL_Rotation).GetConstructor(new Type[] { typeof(double), typeof(double), typeof(double), typeof(double) }); - private static readonly ConstructorInfo lslStringConstructorInfo = typeof(LSL_String).GetConstructor(new Type[] { typeof(string) }); - public static readonly ConstructorInfo lslVectorConstructorInfo = typeof(LSL_Vector).GetConstructor(new Type[] { typeof(double), typeof(double), typeof(double) }); - private static readonly ConstructorInfo scriptBadCallNoExceptionConstructorInfo = typeof(ScriptBadCallNoException).GetConstructor(new Type[] { typeof(int) }); - private static readonly ConstructorInfo scriptChangeStateExceptionConstructorInfo = typeof(ScriptChangeStateException).GetConstructor(new Type[] { typeof(int) }); - private static readonly ConstructorInfo scriptRestoreCatchExceptionConstructorInfo = typeof(ScriptRestoreCatchException).GetConstructor(new Type[] { typeof(Exception) }); - private static readonly ConstructorInfo scriptUndefinedStateExceptionConstructorInfo = typeof(ScriptUndefinedStateException).GetConstructor(new Type[] { typeof(string) }); - private static readonly ConstructorInfo sdtClassConstructorInfo = typeof(XMRSDTypeClObj).GetConstructor(new Type[] { typeof(XMRInstAbstract), typeof(int) }); - private static readonly ConstructorInfo xmrArrayConstructorInfo = typeof(XMR_Array).GetConstructor(new Type[] { typeof(XMRInstAbstract) }); + private static readonly Type[] instanceTypeArg = [typeof(XMRInstAbstract)]; + private static readonly string[] instanceNameArg = ["$xmrthis"]; + + private static readonly ConstructorInfo lslFloatConstructorInfo = typeof(LSL_Float).GetConstructor([typeof(double)]); + private static readonly ConstructorInfo lslIntegerConstructorInfo = typeof(LSL_Integer).GetConstructor([typeof(int)]); + private static readonly ConstructorInfo lslListConstructorInfo = typeof(LSL_List).GetConstructor([typeof(object[])]); + public static readonly ConstructorInfo lslRotationConstructorInfo = typeof(LSL_Rotation).GetConstructor([typeof(double), typeof(double), typeof(double), typeof(double)]); + private static readonly ConstructorInfo lslStringConstructorInfo = typeof(LSL_String).GetConstructor([typeof(string)]); + public static readonly ConstructorInfo lslVectorConstructorInfo = typeof(LSL_Vector).GetConstructor([typeof(double), typeof(double), typeof(double)]); + private static readonly ConstructorInfo scriptBadCallNoExceptionConstructorInfo = typeof(ScriptBadCallNoException).GetConstructor([typeof(int)]); + private static readonly ConstructorInfo scriptChangeStateExceptionConstructorInfo = typeof(ScriptChangeStateException).GetConstructor([typeof(int)]); + private static readonly ConstructorInfo scriptRestoreCatchExceptionConstructorInfo = typeof(ScriptRestoreCatchException).GetConstructor([typeof(Exception)]); + private static readonly ConstructorInfo scriptUndefinedStateExceptionConstructorInfo = typeof(ScriptUndefinedStateException).GetConstructor([typeof(string)]); + private static readonly ConstructorInfo sdtClassConstructorInfo = typeof(XMRSDTypeClObj).GetConstructor([typeof(XMRInstAbstract), typeof(int)]); + private static readonly ConstructorInfo xmrArrayConstructorInfo = typeof(XMR_Array).GetConstructor([typeof(XMRInstAbstract)]); private static readonly FieldInfo callModeFieldInfo = typeof(XMRInstAbstract).GetField("callMode"); private static readonly FieldInfo doGblInitFieldInfo = typeof(XMRInstAbstract).GetField("doGblInit"); private static readonly FieldInfo ehArgsFieldInfo = typeof(XMRInstAbstract).GetField("ehArgs"); @@ -116,29 +116,29 @@ public class ScriptCodeGen: IScriptCodeGen private static readonly MethodInfo arrayClearMethodInfo = typeof(XMR_Array).GetMethod("__pub_clear", Array.Empty()); private static readonly MethodInfo arrayCountMethodInfo = typeof(XMR_Array).GetMethod("__pub_count", Array.Empty()); - private static readonly MethodInfo arrayIndexMethodInfo = typeof(XMR_Array).GetMethod("__pub_index", new Type[] { typeof(int) }); - private static readonly MethodInfo arrayValueMethodInfo = typeof(XMR_Array).GetMethod("__pub_value", new Type[] { typeof(int) }); + private static readonly MethodInfo arrayIndexMethodInfo = typeof(XMR_Array).GetMethod("__pub_index", [typeof(int)]); + private static readonly MethodInfo arrayValueMethodInfo = typeof(XMR_Array).GetMethod("__pub_value", [typeof(int)]); private static readonly MethodInfo checkRunStackMethInfo = typeof(XMRInstAbstract).GetMethod("CheckRunStack", Array.Empty()); private static readonly MethodInfo checkRunQuickMethInfo = typeof(XMRInstAbstract).GetMethod("CheckRunQuick", Array.Empty()); - private static readonly MethodInfo ehArgUnwrapFloat = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapFloat", new Type[] { typeof(object) }); - private static readonly MethodInfo ehArgUnwrapInteger = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapInteger", new Type[] { typeof(object) }); - private static readonly MethodInfo ehArgUnwrapRotation = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapRotation", new Type[] { typeof(object) }); - private static readonly MethodInfo ehArgUnwrapString = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapString", new Type[] { typeof(object) }); - private static readonly MethodInfo ehArgUnwrapVector = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapVector", new Type[] { typeof(object) }); - private static readonly MethodInfo xmrArrPubIndexMethod = typeof(XMR_Array).GetMethod("__pub_index", new Type[] { typeof(int) }); - private static readonly MethodInfo xmrArrPubValueMethod = typeof(XMR_Array).GetMethod("__pub_value", new Type[] { typeof(int) }); - private static readonly MethodInfo captureStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("CaptureStackFrame", new Type[] { typeof(string), typeof(int), typeof(int) }); - private static readonly MethodInfo restoreStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("RestoreStackFrame", new Type[] { typeof(string), typeof(int).MakeByRefType() }); - private static readonly MethodInfo stringCompareMethodInfo = GetStaticMethod(typeof(String), "Compare", new Type[] { typeof(string), typeof(string), typeof(StringComparison) }); - private static readonly MethodInfo stringConcat2MethodInfo = GetStaticMethod(typeof(String), "Concat", new Type[] { typeof(string), typeof(string) }); - private static readonly MethodInfo stringConcat3MethodInfo = GetStaticMethod(typeof(String), "Concat", new Type[] { typeof(string), typeof(string), typeof(string) }); - private static readonly MethodInfo stringConcat4MethodInfo = GetStaticMethod(typeof(String), "Concat", new Type[] { typeof(string), typeof(string), typeof(string), typeof(string) }); - private static readonly MethodInfo lslRotationNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLRotationNegate", new Type[] { typeof(LSL_Rotation) }); - private static readonly MethodInfo lslVectorNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLVectorNegate", new Type[] { typeof(LSL_Vector) }); - private static readonly MethodInfo scriptRestoreCatchExceptionUnwrap = GetStaticMethod(typeof(ScriptRestoreCatchException), "Unwrap", new Type[] { typeof(Exception) }); - private static readonly MethodInfo thrownExceptionWrapMethodInfo = GetStaticMethod(typeof(ScriptThrownException), "Wrap", new Type[] { typeof(object) }); - private static readonly MethodInfo catchExcToStrMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "CatchExcToStr", new Type[] { typeof(Exception) }); - private static readonly MethodInfo consoleWriteMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "ConsoleWrite", new Type[] { typeof(object) }); + private static readonly MethodInfo ehArgUnwrapFloat = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapFloat", [typeof(object)]); + private static readonly MethodInfo ehArgUnwrapInteger = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapInteger", [typeof(object)]); + private static readonly MethodInfo ehArgUnwrapRotation = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapRotation", [typeof(object)]); + private static readonly MethodInfo ehArgUnwrapString = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapString", [typeof(object)]); + private static readonly MethodInfo ehArgUnwrapVector = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapVector", [typeof(object)]); + private static readonly MethodInfo xmrArrPubIndexMethod = typeof(XMR_Array).GetMethod("__pub_index", [typeof(int)]); + private static readonly MethodInfo xmrArrPubValueMethod = typeof(XMR_Array).GetMethod("__pub_value", [typeof(int)]); + private static readonly MethodInfo captureStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("CaptureStackFrame", [typeof(string), typeof(int), typeof(int)]); + private static readonly MethodInfo restoreStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("RestoreStackFrame", [typeof(string), typeof(int).MakeByRefType()]); + private static readonly MethodInfo stringCompareMethodInfo = GetStaticMethod(typeof(BinOpStr), "StringCompareOrdinal", [typeof(string), typeof(string)]); + private static readonly MethodInfo stringConcat2MethodInfo = GetStaticMethod(typeof(BinOpStr), "StringConcat", [typeof(string), typeof(string)]); + private static readonly MethodInfo stringConcat3MethodInfo = GetStaticMethod(typeof(BinOpStr), "StringConcat", [typeof(string), typeof(string), typeof(string)]); + private static readonly MethodInfo stringConcat4MethodInfo = GetStaticMethod(typeof(BinOpStr), "StringConcat", [typeof(string), typeof(string), typeof(string), typeof(string)]); + private static readonly MethodInfo lslRotationNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLRotationNegate", [typeof(LSL_Rotation)]); + private static readonly MethodInfo lslVectorNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLVectorNegate", [typeof(LSL_Vector)]); + private static readonly MethodInfo scriptRestoreCatchExceptionUnwrap = GetStaticMethod(typeof(ScriptRestoreCatchException), "Unwrap", [typeof(Exception)]); + private static readonly MethodInfo thrownExceptionWrapMethodInfo = GetStaticMethod(typeof(ScriptThrownException), "Wrap", [typeof(object)]); + private static readonly MethodInfo catchExcToStrMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "CatchExcToStr", [typeof(Exception)]); + private static readonly MethodInfo consoleWriteMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "ConsoleWrite", [typeof(object)]); public static void ConsoleWrite(object o) { o ??= "<>"; @@ -3005,7 +3005,6 @@ private void OutputStrCase(CompValu testRVal, TokenSwitchCase thisCase, ScriptMy { testRVal.PushVal(this, thisCase, tokenTypeStr); ilGen.Emit(thisCase, OpCodes.Ldstr, thisCase.str1); - ilGen.Emit(thisCase, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); ilGen.Emit(thisCase, OpCodes.Call, stringCompareMethodInfo); ilGen.Emit(thisCase, OpCodes.Brfalse, thisCase.label); ilGen.Emit(thisCase, OpCodes.Br, defaultLabel); @@ -3030,7 +3029,6 @@ private void OutputStrCase(CompValu testRVal, TokenSwitchCase thisCase, ScriptMy // Maybe save comparison result in a temp. testRVal.PushVal(this, thisCase, tokenTypeStr); ilGen.Emit(thisCase, OpCodes.Ldstr, thisCase.str1); - ilGen.Emit(thisCase, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); ilGen.Emit(thisCase, OpCodes.Call, stringCompareMethodInfo); if(cmpv1 != null) { @@ -3046,7 +3044,6 @@ private void OutputStrCase(CompValu testRVal, TokenSwitchCase thisCase, ScriptMy { testRVal.PushVal(this, thisCase, tokenTypeStr); ilGen.Emit(thisCase, OpCodes.Ldstr, thisCase.str2); - ilGen.Emit(thisCase, OpCodes.Ldc_I4, (int)StringComparison.Ordinal); ilGen.Emit(thisCase, OpCodes.Call, stringCompareMethodInfo); } else @@ -4296,7 +4293,7 @@ private CompValu GenerateFromRValOpBin(TokenRValOpBin token) if((leftType is TokenTypeSDTypeClass sdtType) && right.type is not TokenTypeUndef) { TokenDeclSDTypeClass sdtDecl = sdtType.decl; - TokenType[] argsig = new TokenType[] { right.type }; + TokenType[] argsig = [right.type]; TokenName funcName = new (token.opcode, "$op" + opcodeIndex); TokenDeclVar declFunc = FindThisMember(sdtDecl, funcName, argsig); if(declFunc != null) @@ -4304,7 +4301,7 @@ private CompValu GenerateFromRValOpBin(TokenRValOpBin token) CheckAccess(declFunc, funcName); left = GenerateFromRVal(token.rValLeft); CompValu method = AccessInstanceMember(declFunc, left, token, false); - CompValu[] argRVals = new CompValu[] { right }; + CompValu[] argRVals = [right]; return GenerateACall(method, argRVals, token); } } diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs index d7df7d7829e..98bb5897ffa 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs @@ -532,6 +532,7 @@ public static void PrintParamString(StringBuilder sb, string p) * @param args = type/location of arguments (types match function definition) */ + /* public class TokenDeclInline_LLAbs: TokenDeclInline { public TokenDeclInline_LLAbs(VarDict ifd) @@ -589,7 +590,7 @@ public override void CodeGen(ScriptCodeGen scg, Token errorAt, CompValuTemp resu result.Pop(scg, errorAt, new TokenTypeFloat(null)); } } - + */ public class TokenDeclInline_GetFreeMemory: TokenDeclInline { private static readonly MethodInfo getFreeMemMethInfo = typeof(XMRInstAbstract).GetMethod("xmrHeapLeft", new Type[] { }); @@ -623,6 +624,7 @@ public override void CodeGen(ScriptCodeGen scg, Token errorAt, CompValuTemp resu result.Pop(scg, errorAt, new TokenTypeInt(null)); } } + /** * @brief Generate code for the usual ll...() functions. From 4d552360dddbd7038134e1b58e626a28843a07fe Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2024 23:34:35 +0100 Subject: [PATCH 10/12] also incremenet os_apiversion --- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 6b7c7bbbd1e..1ccaf85fa83 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public partial class ScriptBaseClass { // SCRIPTS CONSTANTS - public static readonly LSLInteger OS_APIVERSION = 22; + public static readonly LSLInteger OS_APIVERSION = 23; public static readonly LSLInteger TRUE = 1; public static readonly LSLInteger FALSE = 0; From 230a87d5c9ebdb13a74368b9238fd5af45ff1f70 Mon Sep 17 00:00:00 2001 From: Mike Dickson Date: Tue, 30 Apr 2024 21:00:40 -0400 Subject: [PATCH 11/12] Remove references to System.Web. Thats a .NET Framework thing. --- OpenSim/Addons/Groups/OpenSim.Addons.Groups.csproj | 3 --- OpenSim/Addons/OfflineIM/OpenSim.Addons.OfflineIM.csproj | 3 --- OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs | 7 ------- .../Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 8 -------- .../Handlers/GetTexture/GetTextureRobustHandler.cs | 6 ------ .../Handlers/OpenSim.Capabilities.Handlers.Tests.csproj | 3 --- .../Handlers/OpenSim.Capabilities.Handlers.csproj | 3 --- OpenSim/Capabilities/OpenSim.Capabilities.csproj | 3 --- .../Framework/Console/OpenSim.Framework.Console.csproj | 3 --- OpenSim/Framework/OpenSim.Framework.csproj | 3 --- OpenSim/Framework/RestClient.cs | 1 - .../Servers/HttpServer/Interfaces/IOSHttpRequest.cs | 1 - .../Servers/HttpServer/Interfaces/IOSHttpResponse.cs | 4 ---- .../Servers/HttpServer/OSHttpServer/HttpRequest.cs | 1 - .../OpenSim.Framework.Servers.HttpServer.csproj | 3 --- OpenSim/Framework/WebUtil.cs | 1 - .../Caps/OpenSim.Region.ClientStack.LindenCaps.csproj | 3 --- .../UDP/OpenSim.Region.ClientStack.LindenUDP.csproj | 3 --- .../Region/CoreModules/OpenSim.Region.CoreModules.csproj | 3 --- OpenSim/Region/Framework/OpenSim.Region.Framework.csproj | 3 --- .../OptionalModules/OpenSim.Region.OptionalModules.csproj | 3 --- .../OpenSim.Region.ScriptEngine.Shared.Api.csproj | 3 --- .../OpenSim.Region.ScriptEngine.Shared.Api.Runtime.csproj | 3 --- .../OpenSim.Region.ScriptEngine.Shared.Instance.csproj | 3 --- .../Shared/OpenSim.Region.ScriptEngine.Shared.csproj | 3 --- OpenSim/Server/Base/OpenSim.Server.Base.csproj | 3 --- .../Server/Handlers/Authentication/OpenIdServerHandler.cs | 3 --- .../Handlers/Freeswitch/FreeswitchServerConnector.cs | 2 -- .../Server/Handlers/OpenSim.Server.Handlers.Tests.csproj | 3 --- OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj | 3 --- .../Connectors/OpenSim.Services.Connectors.csproj | 3 --- .../Friends/OpenSim.Services.FriendsService.csproj | 3 --- .../OpenSim.Services.SimulationService.csproj | 3 --- .../OpenSim.Services.UserAccountService.csproj | 3 --- ThirdParty/SmartThreadPool/SmartThreadPool.csproj | 5 ----- addon-modules/Gloebit/GloebitMoneyModule/Gloebit.csproj | 3 --- addon-modules/Gloebit/GloebitMoneyModule/GloebitAPI.cs | 5 ++--- 37 files changed, 2 insertions(+), 117 deletions(-) diff --git a/OpenSim/Addons/Groups/OpenSim.Addons.Groups.csproj b/OpenSim/Addons/Groups/OpenSim.Addons.Groups.csproj index 59ac44cf54e..03f11ae98a2 100644 --- a/OpenSim/Addons/Groups/OpenSim.Addons.Groups.csproj +++ b/OpenSim/Addons/Groups/OpenSim.Addons.Groups.csproj @@ -31,9 +31,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Addons/OfflineIM/OpenSim.Addons.OfflineIM.csproj b/OpenSim/Addons/OfflineIM/OpenSim.Addons.OfflineIM.csproj index 37d8c9c8837..f7a0809781a 100644 --- a/OpenSim/Addons/OfflineIM/OpenSim.Addons.OfflineIM.csproj +++ b/OpenSim/Addons/OfflineIM/OpenSim.Addons.OfflineIM.csproj @@ -24,9 +24,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index c4ae9818302..aa63c09c2dd 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs @@ -27,17 +27,10 @@ using System; using System.Collections; -using System.Collections.Specialized; using System.Reflection; -using System.IO; -using System.Web; using log4net; -using Nini.Config; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index b823e31eb75..c82540da7ca 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -27,23 +27,15 @@ using System; using System.Collections; -using System.Collections.Specialized; using System.Drawing; using System.Drawing.Imaging; using System.Reflection; using System.IO; -using System.Web; using log4net; -using Nini.Config; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenMetaverse.Imaging; using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; -using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Capabilities.Handlers { diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs index dfc7fc7832f..d8348886d6a 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs @@ -26,7 +26,6 @@ */ using System; -using System.Collections; using System.Collections.Specialized; using System.Drawing; using System.Drawing.Imaging; @@ -35,16 +34,11 @@ using System.Net; using System.Web; using log4net; -using Nini.Config; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenMetaverse.Imaging; using OpenSim.Framework; -using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; -using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Capabilities.Handlers { diff --git a/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.Tests.csproj b/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.Tests.csproj index 2a34b485357..fbb416e708d 100644 --- a/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.Tests.csproj +++ b/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.Tests.csproj @@ -23,9 +23,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj b/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj index 085a93c8198..5379b19dc8c 100644 --- a/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj +++ b/OpenSim/Capabilities/Handlers/OpenSim.Capabilities.Handlers.csproj @@ -27,9 +27,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Capabilities/OpenSim.Capabilities.csproj b/OpenSim/Capabilities/OpenSim.Capabilities.csproj index cb989082bc8..1e17cc635f4 100644 --- a/OpenSim/Capabilities/OpenSim.Capabilities.csproj +++ b/OpenSim/Capabilities/OpenSim.Capabilities.csproj @@ -23,9 +23,6 @@ ..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Framework/Console/OpenSim.Framework.Console.csproj b/OpenSim/Framework/Console/OpenSim.Framework.Console.csproj index 83329488826..901fa5d1f8a 100644 --- a/OpenSim/Framework/Console/OpenSim.Framework.Console.csproj +++ b/OpenSim/Framework/Console/OpenSim.Framework.Console.csproj @@ -18,9 +18,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Framework/OpenSim.Framework.csproj b/OpenSim/Framework/OpenSim.Framework.csproj index d528fdf09fc..83ee00b34cb 100644 --- a/OpenSim/Framework/OpenSim.Framework.csproj +++ b/OpenSim/Framework/OpenSim.Framework.csproj @@ -31,9 +31,6 @@ False - - False - ..\..\bin\XMLRPC.dll False diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index 49c7f632a55..b79f0c76a0b 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -33,7 +33,6 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Text; -using System.Threading; using System.Web; using log4net; diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs index 2f75276b987..61fa8239a3d 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpRequest.cs @@ -32,7 +32,6 @@ using System.IO; using System.Net; using System.Text; -using System.Web; namespace OpenSim.Framework.Servers.HttpServer { diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs index 7a128489d1d..d2e986fe88b 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IOSHttpResponse.cs @@ -25,13 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections; -using System.Collections.Specialized; using System.IO; using System.Net; using System.Text; -using System.Web; namespace OpenSim.Framework.Servers.HttpServer { diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpRequest.cs index d0ed6677e3e..39282af878c 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpRequest.cs @@ -2,7 +2,6 @@ using System.Collections.Specialized; using System.IO; using System.Net; -using System.Text; using System.Web; using OpenSim.Framework; using OSHttpServer.Exceptions; diff --git a/OpenSim/Framework/Servers/HttpServer/OpenSim.Framework.Servers.HttpServer.csproj b/OpenSim/Framework/Servers/HttpServer/OpenSim.Framework.Servers.HttpServer.csproj index 7922205eb5d..14c11c8b996 100644 --- a/OpenSim/Framework/Servers/HttpServer/OpenSim.Framework.Servers.HttpServer.csproj +++ b/OpenSim/Framework/Servers/HttpServer/OpenSim.Framework.Servers.HttpServer.csproj @@ -18,9 +18,6 @@ ..\..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\..\bin\XMLRPC.dll False diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 1a9d9cc1e51..9d3e682bf7e 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -47,7 +47,6 @@ using System.Net.Http; using System.Security.Authentication; using System.Runtime.CompilerServices; -using System.Threading; namespace OpenSim.Framework { 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 522ab5cac3e..7108e17d32a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/OpenSim.Region.ClientStack.LindenCaps.csproj +++ b/OpenSim/Region/ClientStack/Linden/Caps/OpenSim.Region.ClientStack.LindenCaps.csproj @@ -23,9 +23,6 @@ ..\..\..\..\..\bin\OpenMetaverseTypes.dll False - - False - 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 3bcd3b0bc3d..d0516e99b79 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSim.Region.ClientStack.LindenUDP.csproj +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSim.Region.ClientStack.LindenUDP.csproj @@ -36,9 +36,6 @@ ..\..\..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj b/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj index 57f37faf737..6c160b150c3 100644 --- a/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj +++ b/OpenSim/Region/CoreModules/OpenSim.Region.CoreModules.csproj @@ -35,9 +35,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\Warp3D.dll False diff --git a/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj b/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj index 8c97c2eb7b8..ee26e00e137 100644 --- a/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj +++ b/OpenSim/Region/Framework/OpenSim.Region.Framework.csproj @@ -24,9 +24,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\XMLRPC.dll False diff --git a/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj b/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj index 288527cc610..7e32ac50c18 100644 --- a/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj +++ b/OpenSim/Region/OptionalModules/OpenSim.Region.OptionalModules.csproj @@ -31,9 +31,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\XMLRPC.dll False 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 8903c90ac56..e1f7f37659c 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 @@ -27,9 +27,6 @@ ..\..\..\..\..\..\bin\OpenMetaverseTypes.dll False - - False - 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 60c47960e69..0137261268c 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,9 +15,6 @@ ..\..\..\..\..\..\bin\OpenMetaverseTypes.dll False - - False - 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 75b4ead7125..35ca022845b 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,9 +15,6 @@ ..\..\..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj b/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj index 1b38087d25e..544d136487b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj +++ b/OpenSim/Region/ScriptEngine/Shared/OpenSim.Region.ScriptEngine.Shared.csproj @@ -16,9 +16,6 @@ ..\..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Server/Base/OpenSim.Server.Base.csproj b/OpenSim/Server/Base/OpenSim.Server.Base.csproj index 5013fcfc884..cab6e5dba1f 100644 --- a/OpenSim/Server/Base/OpenSim.Server.Base.csproj +++ b/OpenSim/Server/Base/OpenSim.Server.Base.csproj @@ -29,9 +29,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index 254b82fadd9..5a342125bd1 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -34,11 +34,8 @@ using DotNetOpenId; using DotNetOpenId.Provider; using OpenSim.Framework; -using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Server.Handlers.Base; using OpenSim.Services.Interfaces; -using Nini.Config; using OpenMetaverse; namespace OpenSim.Server.Handlers.Authentication diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs index 0037c313b4c..f960259b103 100644 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs +++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs @@ -35,8 +35,6 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Handlers.Base; using log4net; -using OpenMetaverse; -using OpenMetaverse.StructuredData; namespace OpenSim.Server.Handlers.Freeswitch { diff --git a/OpenSim/Server/Handlers/OpenSim.Server.Handlers.Tests.csproj b/OpenSim/Server/Handlers/OpenSim.Server.Handlers.Tests.csproj index ddd86435c65..a9e95e1741c 100644 --- a/OpenSim/Server/Handlers/OpenSim.Server.Handlers.Tests.csproj +++ b/OpenSim/Server/Handlers/OpenSim.Server.Handlers.Tests.csproj @@ -19,9 +19,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\XMLRPC.dll False diff --git a/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj b/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj index c217c1e4b1a..8eb96c1a90c 100644 --- a/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj +++ b/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj @@ -27,9 +27,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\XMLRPC.dll False diff --git a/OpenSim/Services/Connectors/OpenSim.Services.Connectors.csproj b/OpenSim/Services/Connectors/OpenSim.Services.Connectors.csproj index 121d2258e7a..c86b6d30b47 100644 --- a/OpenSim/Services/Connectors/OpenSim.Services.Connectors.csproj +++ b/OpenSim/Services/Connectors/OpenSim.Services.Connectors.csproj @@ -29,9 +29,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\XMLRPC.dll False diff --git a/OpenSim/Services/Friends/OpenSim.Services.FriendsService.csproj b/OpenSim/Services/Friends/OpenSim.Services.FriendsService.csproj index f4c42ddf7da..291e92a188c 100644 --- a/OpenSim/Services/Friends/OpenSim.Services.FriendsService.csproj +++ b/OpenSim/Services/Friends/OpenSim.Services.FriendsService.csproj @@ -22,9 +22,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/OpenSim/Services/SimulationService/OpenSim.Services.SimulationService.csproj b/OpenSim/Services/SimulationService/OpenSim.Services.SimulationService.csproj index 217a2157386..f6dcebbf367 100644 --- a/OpenSim/Services/SimulationService/OpenSim.Services.SimulationService.csproj +++ b/OpenSim/Services/SimulationService/OpenSim.Services.SimulationService.csproj @@ -23,9 +23,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\XMLRPC.dll False diff --git a/OpenSim/Services/UserAccountService/OpenSim.Services.UserAccountService.csproj b/OpenSim/Services/UserAccountService/OpenSim.Services.UserAccountService.csproj index 9a95ff3dd26..6db34c0d73d 100644 --- a/OpenSim/Services/UserAccountService/OpenSim.Services.UserAccountService.csproj +++ b/OpenSim/Services/UserAccountService/OpenSim.Services.UserAccountService.csproj @@ -22,9 +22,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.csproj b/ThirdParty/SmartThreadPool/SmartThreadPool.csproj index ca82f8193dc..c59fe2310e2 100644 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.csproj +++ b/ThirdParty/SmartThreadPool/SmartThreadPool.csproj @@ -10,9 +10,4 @@ - - - False - - \ No newline at end of file diff --git a/addon-modules/Gloebit/GloebitMoneyModule/Gloebit.csproj b/addon-modules/Gloebit/GloebitMoneyModule/Gloebit.csproj index ec6eeabee51..33ee32cbaa4 100644 --- a/addon-modules/Gloebit/GloebitMoneyModule/Gloebit.csproj +++ b/addon-modules/Gloebit/GloebitMoneyModule/Gloebit.csproj @@ -26,9 +26,6 @@ ..\..\..\bin\OpenMetaverseTypes.dll False - - False - ..\..\..\bin\XMLRPC.dll False diff --git a/addon-modules/Gloebit/GloebitMoneyModule/GloebitAPI.cs b/addon-modules/Gloebit/GloebitMoneyModule/GloebitAPI.cs index e7da369f190..5288f2c9a9c 100644 --- a/addon-modules/Gloebit/GloebitMoneyModule/GloebitAPI.cs +++ b/addon-modules/Gloebit/GloebitMoneyModule/GloebitAPI.cs @@ -23,10 +23,8 @@ */ using System; -using System.Collections; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Net; using System.Reflection; using System.Text; @@ -41,7 +39,8 @@ // to an API wrapper which uses this API. The separation might make both easier to maintain as this is ported to // new platforms. -namespace Gloebit.GloebitMoneyModule { +namespace Gloebit.GloebitMoneyModule +{ public class GloebitAPI { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); From 4077ed188f05cda45a965626bba3e26e8ef93e6b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 2 May 2024 18:22:41 +0100 Subject: [PATCH 12/12] add another asset --- bin/assets/SettingsAssetSet/MiddayRP2.dat | 2 ++ bin/assets/SettingsAssetSet/SettingsAssetSet.xml | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 bin/assets/SettingsAssetSet/MiddayRP2.dat diff --git a/bin/assets/SettingsAssetSet/MiddayRP2.dat b/bin/assets/SettingsAssetSet/MiddayRP2.dat new file mode 100644 index 00000000000..da83a6c6c4a --- /dev/null +++ b/bin/assets/SettingsAssetSet/MiddayRP2.dat @@ -0,0 +1,2 @@ + +{'absorption_config':[{'constant_term':r0,'exp_scale':r0,'exp_term':r0,'linear_term':r0,'width':r25000},{'constant_term':r1,'exp_scale':r0,'exp_term':r0,'linear_term':r0,'width':r0}],'bloom_id':u3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef,'cloud_color':[r0.5412,r0.5412,r0.5412],'cloud_id':u6e500a99-8831-47d2-b2a8-2e725396d449,'cloud_pos_density1':[r0.73,r0.71,r0.26],'cloud_pos_density2':[r0.62,r0.49,r0.89],'cloud_scale':r0.75,'cloud_scroll_rate':[r0,r0],'cloud_shadow':r0.54,'cloud_variance':r0,'dome_offset':r0.96,'dome_radius':r15000,'droplet_radius':r810.81,'flags':i0,'gamma':r1,'glow':[r5,r0.001,r-0.48],'halo_id':u12149143-f599-91a7-77ac-b52a3c0f59cd,'ice_level':r0,'legacy_haze':{'ambient':[r0,r0,r0],'blue_density':[r0.179,r0.37,r0.94],'blue_horizon':[r0.3451,r0.3451,r0.3451],'density_multiplier':r0.00011,'distance_multiplier':r6.5,'haze_density':r0.78,'haze_horizon':r0.25},'max_y':r2200,'mie_config':[{'anisotropy':r0.8,'constant_term':r0,'exp_scale':r-0.00083,'exp_term':r1,'linear_term':r0,'width':r0}],'moisture_level':r0,'moon_brightness':r0.5,'moon_id':ud07f6eed-b96a-47cd-b51d-400ad4a1c428,'moon_rotation':[r-0.385,r0.385,r0.593,r0.593],'moon_scale':r1,'name':'MiddayRP2','planet_radius':r6360,'rainbow_id':u11b4c57c-56b3-04ed-1f82-2004363882e4,'rayleigh_config':[{'constant_term':r0,'exp_scale':r-0.000125,'exp_term':r1,'linear_term':r0,'width':r0}],'reflection_probe_ambiance':r1,'sky_bottom_radius':r6360,'sky_top_radius':r6420,'star_brightness':r0,'sun_arc_radians':r0.00045,'sun_id':u00000000-0000-0000-0000-000000000000,'sun_rotation':[r0.1717,r-0.4818,r0.2885,r0.8094],'sun_scale':r1,'sunlight_color':[r1.7412,r1.7412,r1.929],'type':'sky'} diff --git a/bin/assets/SettingsAssetSet/SettingsAssetSet.xml b/bin/assets/SettingsAssetSet/SettingsAssetSet.xml index 526dc661853..c3bc2c1f41c 100644 --- a/bin/assets/SettingsAssetSet/SettingsAssetSet.xml +++ b/bin/assets/SettingsAssetSet/SettingsAssetSet.xml @@ -35,6 +35,12 @@ + +
+ + + +