diff options
author | Nikias Bassen | 2020-05-17 20:08:26 +0200 |
---|---|---|
committer | Nikias Bassen | 2020-05-17 20:08:26 +0200 |
commit | 3166d0dfa402dc775298c3a3e0b1c214e5b109b1 (patch) | |
tree | e4914baa1b33e90003526e88d6365149e25458b0 | |
parent | 42e40aacc333ee759425e7d64124d31c312c6f40 (diff) | |
download | libimobiledevice-3166d0dfa402dc775298c3a3e0b1c214e5b109b1.tar.gz libimobiledevice-3166d0dfa402dc775298c3a3e0b1c214e5b109b1.tar.bz2 |
idevice: [OpenSSL] Fix SSL_read with non-blocking sockets
-rw-r--r-- | src/idevice.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/idevice.c b/src/idevice.c index 3c312d2..0a62907 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -590,14 +590,23 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive_timeout(idevice_ #ifdef HAVE_OPENSSL int r = SSL_read(connection->ssl_data->session, (void*)((char*)(data+received)), (int)len-received); + if (r > 0) { + received += r; + } else { + int sslerr = SSL_get_error(connection->ssl_data->session, r); + if (sslerr == SSL_ERROR_WANT_READ) { + continue; + } + break; + } #else ssize_t r = gnutls_record_recv(connection->ssl_data->session, (void*)(data+received), (size_t)len-received); -#endif if (r > 0) { received += r; } else { break; } +#endif } debug_info("SSL_read %d, received %d", len, received); |