Added packet_queue_flush function