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)
|
if (oPacket.Buffer == null)
|
||||||
return;
|
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
|
// 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);
|
Interlocked.Increment(ref m_udpClient.PacketsResent);
|
||||||
|
|
||||||
|
|
|
@ -1188,8 +1188,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
SyncSend(buffer);
|
SyncSend(buffer);
|
||||||
|
|
||||||
// Keep track of when this packet was sent out (right now)
|
// Keep track of when this packet was sent out (right now)
|
||||||
int enow = Environment.TickCount & Int32.MaxValue;
|
Interlocked.Exchange(ref outgoingPacket.TickCount, Environment.TickCount & Int32.MaxValue);
|
||||||
Interlocked.Exchange(ref outgoingPacket.TickCount, enow);
|
|
||||||
|
|
||||||
if (outgoingPacket.UnackedMethod == null)
|
if (outgoingPacket.UnackedMethod == null)
|
||||||
FreeUDPBuffer(buffer);
|
FreeUDPBuffer(buffer);
|
||||||
|
|
|
@ -192,6 +192,7 @@ namespace OpenMetaverse
|
||||||
m_udpBuffersPool[m_udpBuffersPoolPtr] = null;
|
m_udpBuffersPool[m_udpBuffersPoolPtr] = null;
|
||||||
m_udpBuffersPoolPtr--;
|
m_udpBuffersPoolPtr--;
|
||||||
buf.RemoteEndPoint = remoteEndpoint;
|
buf.RemoteEndPoint = remoteEndpoint;
|
||||||
|
buf.DataLength = 0;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,10 +203,13 @@ namespace OpenMetaverse
|
||||||
{
|
{
|
||||||
lock (m_udpBuffersPoolLock)
|
lock (m_udpBuffersPoolLock)
|
||||||
{
|
{
|
||||||
|
if(buf.DataLength < 0)
|
||||||
|
return; // avoid duplicated free that may still happen
|
||||||
|
|
||||||
if (m_udpBuffersPoolPtr < 999)
|
if (m_udpBuffersPoolPtr < 999)
|
||||||
{
|
{
|
||||||
buf.RemoteEndPoint = null;
|
buf.RemoteEndPoint = null;
|
||||||
buf.DataLength = 0;
|
buf.DataLength = -1;
|
||||||
m_udpBuffersPoolPtr++;
|
m_udpBuffersPoolPtr++;
|
||||||
m_udpBuffersPool[m_udpBuffersPoolPtr] = buf;
|
m_udpBuffersPool[m_udpBuffersPoolPtr] = buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (m_packets.TryGetValue(pendingRemove, out OutgoingPacket removedPacket))
|
if (m_packets.TryGetValue(pendingRemove, out OutgoingPacket removedPacket))
|
||||||
{
|
{
|
||||||
m_packets.Remove(pendingRemove);
|
m_packets.Remove(pendingRemove);
|
||||||
if (removedPacket != null)
|
if (removedPacket != null && removedPacket.Buffer != null)
|
||||||
{
|
{
|
||||||
// Update stats
|
// Update stats
|
||||||
Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength);
|
Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength);
|
||||||
|
|
Loading…
Reference in New Issue