From b6ea7c26ac7653a144b5880e3027fcddabe872e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 4 Nov 2009 23:12:56 +0000 Subject: Refine oversized packet handling as per jhurliman. Reallocate the buffer to actual packet size only for oversized packets. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 93c3270..6165984 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting // there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here // to accomodate for both common scenarios and provide ample room for ACK appending in both - int bufferSize = (dataLength > 180) ? LLUDPServer.MTU + 1000 : 200; + int bufferSize = (dataLength > 180) ? LLUDPServer.MTU : 200; UDPPacketBuffer buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize); @@ -359,9 +359,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_log.Error("[LLUDPSERVER]: Packet exceeded buffer size! This could be an indication of packet assembly not obeying the MTU. Type=" + - type + ", DataLength=" + dataLength + ", BufferLength=" + buffer.Data.Length + ". Dropping packet"); - return; + bufferSize = dataLength; + buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize); + + // m_log.Error("[LLUDPSERVER]: Packet exceeded buffer size! This could be an indication of packet assembly not obeying the MTU. Type=" + + // type + ", DataLength=" + dataLength + ", BufferLength=" + buffer.Data.Length + ". Dropping packet"); + Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength); } } -- cgit v1.1