diff options
| author | 2020-05-17 20:08:26 +0200 | |
|---|---|---|
| committer | 2020-05-17 20:08:26 +0200 | |
| commit | 3166d0dfa402dc775298c3a3e0b1c214e5b109b1 (patch) | |
| tree | e4914baa1b33e90003526e88d6365149e25458b0 /src | |
| parent | 42e40aacc333ee759425e7d64124d31c312c6f40 (diff) | |
| download | libimobiledevice-3166d0dfa402dc775298c3a3e0b1c214e5b109b1.tar.gz libimobiledevice-3166d0dfa402dc775298c3a3e0b1c214e5b109b1.tar.bz2 | |
idevice: [OpenSSL] Fix SSL_read with non-blocking sockets
Diffstat (limited to 'src')
| -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_ | |||
| 590 | 590 | ||
| 591 | #ifdef HAVE_OPENSSL | 591 | #ifdef HAVE_OPENSSL |
| 592 | int r = SSL_read(connection->ssl_data->session, (void*)((char*)(data+received)), (int)len-received); | 592 | int r = SSL_read(connection->ssl_data->session, (void*)((char*)(data+received)), (int)len-received); |
| 593 | if (r > 0) { | ||
| 594 | received += r; | ||
| 595 | } else { | ||
| 596 | int sslerr = SSL_get_error(connection->ssl_data->session, r); | ||
| 597 | if (sslerr == SSL_ERROR_WANT_READ) { | ||
| 598 | continue; | ||
| 599 | } | ||
| 600 | break; | ||
| 601 | } | ||
| 593 | #else | 602 | #else |
| 594 | ssize_t r = gnutls_record_recv(connection->ssl_data->session, (void*)(data+received), (size_t)len-received); | 603 | ssize_t r = gnutls_record_recv(connection->ssl_data->session, (void*)(data+received), (size_t)len-received); |
| 595 | #endif | ||
| 596 | if (r > 0) { | 604 | if (r > 0) { |
| 597 | received += r; | 605 | received += r; |
| 598 | } else { | 606 | } else { |
| 599 | break; | 607 | break; |
| 600 | } | 608 | } |
| 609 | #endif | ||
| 601 | } | 610 | } |
| 602 | 611 | ||
| 603 | debug_info("SSL_read %d, received %d", len, received); | 612 | debug_info("SSL_read %d, received %d", len, received); |
