From d1ab11dc2a60ddab0cca214a1c165e386dbb5d43 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 20 Oct 2009 12:43:09 -0700 Subject: Added try/catches in the outgoing packet handler to match the one in the incoming packet handler --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 104 ++++++++++++--------- 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index a6ead5e..3881bdb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -776,61 +776,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP while (base.IsRunning) { - bool resendUnacked = false; - bool sendAcks = false; - bool sendPings = false; - bool packetSent = false; - - elapsedMS += Environment.TickCount - now; - - // Check for pending outgoing resends every 100ms - if (elapsedMS >= 100) - { - resendUnacked = true; - elapsedMS -= 100; - ++elapsed100MS; - } - // Check for pending outgoing ACKs every 500ms - if (elapsed100MS >= 5) - { - sendAcks = true; - elapsed100MS = 0; - ++elapsed500MS; - } - // Send pings to clients every 5000ms - if (elapsed500MS >= 10) + try { - sendPings = true; - elapsed500MS = 0; - } + bool resendUnacked = false; + bool sendAcks = false; + bool sendPings = false; + bool packetSent = false; - m_scene.ClientManager.ForEachSync( - delegate(IClientAPI client) + elapsedMS += Environment.TickCount - now; + + // Check for pending outgoing resends every 100ms + if (elapsedMS >= 100) { - if (client is LLClientView) - { - LLUDPClient udpClient = ((LLClientView)client).UDPClient; + resendUnacked = true; + elapsedMS -= 100; + ++elapsed100MS; + } + // Check for pending outgoing ACKs every 500ms + if (elapsed100MS >= 5) + { + sendAcks = true; + elapsed100MS = 0; + ++elapsed500MS; + } + // Send pings to clients every 5000ms + if (elapsed500MS >= 10) + { + sendPings = true; + elapsed500MS = 0; + } - if (udpClient.IsConnected) + m_scene.ClientManager.ForEachSync( + delegate(IClientAPI client) + { + try { - if (udpClient.DequeueOutgoing()) - packetSent = true; - if (resendUnacked) - ResendUnacked(udpClient); - if (sendAcks) + if (client is LLClientView) { - SendAcks(udpClient); - udpClient.SendPacketStats(); + LLUDPClient udpClient = ((LLClientView)client).UDPClient; + + if (udpClient.IsConnected) + { + if (udpClient.DequeueOutgoing()) + packetSent = true; + if (resendUnacked) + ResendUnacked(udpClient); + if (sendAcks) + { + SendAcks(udpClient); + udpClient.SendPacketStats(); + } + if (sendPings) + SendPing(udpClient); + } } - if (sendPings) - SendPing(udpClient); + } + catch (Exception ex) + { + m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name + " threw an exception: " + ex.Message, ex); } } - } - ); + ); - if (!packetSent) - Thread.Sleep(20); + if (!packetSent) + Thread.Sleep(20); + } + catch (Exception ex) + { + m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex); + } } } -- cgit v1.1