Fix unclean SSL disconnection

This patch prevent an infinite loop when the remote peer disconnects the socket without cleanly closing the SSL connection.