diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 4739ae8..e931f3b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -1185,15 +1185,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1185 | 1185 | ||
1186 | try | 1186 | try |
1187 | { | 1187 | { |
1188 | packet = Packet.BuildPacket(buffer.Data, ref packetEnd, | 1188 | // get a buffer for zero decode using the udp buffers pool |
1189 | // Only allocate a buffer for zerodecoding if the packet is zerocoded | 1189 | UDPPacketBuffer zerodecodebufferholder = null; |
1190 | ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); | 1190 | byte[] zerodecodebuffer = null; |
1191 | // only if needed | ||
1192 | if (((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0)) | ||
1193 | { | ||
1194 | zerodecodebufferholder = GetNewUDPBuffer(null); | ||
1195 | zerodecodebuffer = zerodecodebufferholder.Data; | ||
1196 | } | ||
1197 | |||
1198 | packet = Packet.BuildPacket(buffer.Data, ref packetEnd, zerodecodebuffer); | ||
1191 | // If OpenSimUDPBase.UsePool == true (which is currently separate from the PacketPool) then we | 1199 | // If OpenSimUDPBase.UsePool == true (which is currently separate from the PacketPool) then we |
1192 | // assume that packet construction does not retain a reference to byte[] buffer.Data (instead, all | 1200 | // assume that packet construction does not retain a reference to byte[] buffer.Data (instead, all |
1193 | // bytes are copied out). | 1201 | // bytes are copied out). |
1194 | // packet = PacketPool.Instance.GetPacket(buffer.Data, ref packetEnd, | 1202 | // packet = PacketPool.Instance.GetPacket(buffer.Data, ref packetEnd, zerodecodebuffer); |
1195 | // Only allocate a buffer for zerodecoding if the packet is zerocoded | 1203 | if(zerodecodebufferholder != null) |
1196 | // ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); | 1204 | FreeUDPBuffer(zerodecodebufferholder); |
1197 | } | 1205 | } |
1198 | catch (Exception e) | 1206 | catch (Exception e) |
1199 | { | 1207 | { |