avoid duplicated udpbuffer free that may still happen
parent
8728e4cf2f
commit
1df06f459a
|
@ -4834,8 +4834,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (oPacket.Buffer == null)
|
||||
return;
|
||||
|
||||
m_udpClient.FreeUDPBuffer(oPacket.Buffer);
|
||||
|
||||
// Count this as a resent packet since we are going to requeue all of the updates contained in it
|
||||
Interlocked.Increment(ref m_udpClient.PacketsResent);
|
||||
|
||||
|
|
|
@ -1188,8 +1188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
SyncSend(buffer);
|
||||
|
||||
// Keep track of when this packet was sent out (right now)
|
||||
int enow = Environment.TickCount & Int32.MaxValue;
|
||||
Interlocked.Exchange(ref outgoingPacket.TickCount, enow);
|
||||
Interlocked.Exchange(ref outgoingPacket.TickCount, Environment.TickCount & Int32.MaxValue);
|
||||
|
||||
if (outgoingPacket.UnackedMethod == null)
|
||||
FreeUDPBuffer(buffer);
|
||||
|
|
|
@ -192,6 +192,7 @@ namespace OpenMetaverse
|
|||
m_udpBuffersPool[m_udpBuffersPoolPtr] = null;
|
||||
m_udpBuffersPoolPtr--;
|
||||
buf.RemoteEndPoint = remoteEndpoint;
|
||||
buf.DataLength = 0;
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
@ -202,10 +203,13 @@ namespace OpenMetaverse
|
|||
{
|
||||
lock (m_udpBuffersPoolLock)
|
||||
{
|
||||
if(buf.DataLength < 0)
|
||||
return; // avoid duplicated free that may still happen
|
||||
|
||||
if (m_udpBuffersPoolPtr < 999)
|
||||
{
|
||||
buf.RemoteEndPoint = null;
|
||||
buf.DataLength = 0;
|
||||
buf.DataLength = -1;
|
||||
m_udpBuffersPoolPtr++;
|
||||
m_udpBuffersPool[m_udpBuffersPoolPtr] = buf;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (m_packets.TryGetValue(pendingRemove, out OutgoingPacket removedPacket))
|
||||
{
|
||||
m_packets.Remove(pendingRemove);
|
||||
if (removedPacket != null)
|
||||
if (removedPacket != null && removedPacket.Buffer != null)
|
||||
{
|
||||
// Update stats
|
||||
Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength);
|
||||
|
|
Loading…
Reference in New Issue