Clear packet queue on disconnect. Also, make sure writing/reading are set to false on error