Skip to content
Snippets Groups Projects
Commit 88517a6c authored by Boris Grozev's avatar Boris Grozev
Browse files

Fixes a regression in which RawPackets can be returned for re-use prematurely

parent 65a68298
No related branches found
No related tags found
No related merge requests found
......@@ -272,7 +272,10 @@ protected abstract void doLogPacket(
private boolean send(RawPacket packet)
{
if(!isSocketValid())
{
rawPacketPool.offer(packet);
return false;
}
numberOfPackets++;
for (InetSocketAddress target : targets)
......@@ -377,6 +380,7 @@ public int write(byte[] buffer, int offset, int length)
{
//skip sending the rest, but return them to the pool
fail = true;
continue;
}
}
else
......@@ -385,7 +389,7 @@ public int write(byte[] buffer, int offset, int length)
}
}
if (pkt != null)
if (pkt != null && fail) //if !fail, send() will have returned it
rawPacketPool.offer(pkt);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment