break while loop on disconnect from server