From 8c468f585f1e4a6cf41e8b5c5030b7c09a92aad7 Mon Sep 17 00:00:00 2001 From: Lefteris Chatzimparmpas Date: Wed, 22 Feb 2012 18:59:28 +0100 Subject: [PATCH] Fix the fatal failure caused by an SSL error When a "Connection reset by peer" error was caused while reading through SSL, a restoration of the session should have taken place after all the connection related structures were resetted. But instead a silent, unexpected and unaccountable exit was the end result. This was caused by the underlying socket being closed while trying to shutdown the SSL session. --- src/socket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/socket.c b/src/socket.c index 01812ec..6992354 100644 --- a/src/socket.c +++ b/src/socket.c @@ -187,6 +187,8 @@ close_secure_connection(session *ssn) { if (ssn->sslsocket) { + SSL_set_shutdown(ssn->sslsocket, SSL_SENT_SHUTDOWN | + SSL_RECEIVED_SHUTDOWN); SSL_shutdown(ssn->sslsocket); SSL_free(ssn->sslsocket); ssn->sslsocket = NULL;