From bafe6a9e7255e7946ef234f0a91de772ff9df395 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 13 Mar 2014 02:40:02 +0100 Subject: idevice: call SSL_shutdown a second time if required This will fix that: lockdownd[25] : 00484000 _receive_message: Could not receive size of message, expected 4 bytes, got -1 bytes: (54, Connection reset by peer) --- src/idevice.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/idevice.c b/src/idevice.c index 5fa2e85..d01aa8f 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -820,7 +820,10 @@ idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection) #ifdef HAVE_OPENSSL if (connection->ssl_data->session) { - SSL_shutdown(connection->ssl_data->session); + /* see: https://www.openssl.org/docs/ssl/SSL_shutdown.html#RETURN_VALUES */ + if (SSL_shutdown(connection->ssl_data->session) == 0) { + SSL_shutdown(connection->ssl_data->session); + } } #else if (connection->ssl_data->session) { -- cgit v1.1-32-gdbae