handle_packets takes number of packets as arg, avoid reading too much