avoid duplicated udpbuffer free that may still happen

This commit is contained in:
UbitUmarov
2020-03-04 22:39:44 +00:00
parent 8728e4cf2f
commit 1df06f459a
4 changed files with 8 additions and 7 deletions

View File

@@ -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;
}