Move flush-pkt creation into its own function Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>