From ed8a20dd602bd01d74e0bb1f6ad7c9419dfc4801 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 19 Oct 2008 17:02:39 +0000 Subject: * Fixed UDP server (again) * Guys, there's an endless loop there *ON PURPOSE*. Please don't try to *fix* it. We must continue to process the UDP stream buffer on clients that disconnected nastily until it ends or the UDP server accept thread will die a horrible death. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 3648575..5ceea18 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -306,7 +306,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (SocketException e) { - m_log.ErrorFormat("[CLIENT]: BeginRecieve threw exception " + e.Message + ": " + e.StackTrace ); + // We don't need to see this error, reset connection and get next UDP packet off the buffer + // If the UDP packet is part of the same stream, this will happen several hundreds of times before + // the next set of UDP data is for a valid client. + //m_log.ErrorFormat("[CLIENT]: BeginRecieve threw exception " + e.Message + ": " + e.StackTrace ); + + // ENDLESS LOOP ON PURPOSE! ResetEndPoint(); } } @@ -322,10 +327,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.Error("[UDPSERVER]: " + a); } + // ENDLESS LOOP ON PURPOSE! + + // We need to purge the UDP stream of crap from the client that disconnected nastily or the UDP server will die + // The only way to do that is to beginreceive again! + BeginReceive(); + try { - m_socket.BeginReceiveFrom( - RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref reusedEpSender, ReceivedData, null); + // m_socket.BeginReceiveFrom( + // RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref reusedEpSender, ReceivedData, null); // Ter: For some stupid reason ConnectionReset basically kills our async event structure.. // so therefore.. we've got to tell the server to BeginReceiveFrom again. -- cgit v1.1