Code to handle connection reset by peer events