Drop the first packet instead of the last.

This commit is contained in:
boris 2015-03-30 10:49:39 +00:00
parent bb688bc896
commit 3355481bf8

View File

@ -459,9 +459,14 @@ public class SinglePortUdpHarvester
{
synchronized (queue)
{
// XXX Should we drop the first packet from the queue instead?
if (!queue.offer(buf))
// Drop the first rather than the current packet, so that
// receivers can notice the loss earlier.
if (queue.size() == QUEUE_SIZE)
{
logger.info("Dropping a packet because the queue is full.");
queue.poll();
}
queue.offer(buf);
queue.notifyAll();
}