Add flush logic to the point of adding packets to the queue.