From 2736d36391c324c9db1f9caef1700cf080f97222 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 Apr 2024 22:57:58 +0100 Subject: [PATCH] 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 04bfe5b482..4ce02236ba 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1772,7 +1772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // on to en-US to avoid number parsing issues Culture.SetCurrentCulture(); - while (IsRunningInbound) + while (m_IsRunningInbound) { Scene.ThreadAlive(1); try @@ -1818,7 +1818,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // 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 58d25d66fa..3bb475c8b1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -73,13 +73,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// 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 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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 @@ namespace OpenSim.Region.ClientStack.LindenUDP { 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 @@ namespace OpenSim.Region.ClientStack.LindenUDP { 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 7b7287992c..81395b0b91 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -229,7 +229,6 @@ namespace OpenSim.Region.CoreModules.World.Estate 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 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); - SendRegionInfoPacketToAll(); + sendRegionHandshakeToAll(); } public void SetEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) @@ -588,7 +587,6 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionHandshakeToAll(); -// sendRegionInfoPacketToAll(); } private void HandleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)