diff options
-rw-r--r-- | src/idevice.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/idevice.c b/src/idevice.c index b776e84..5550402 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -447,12 +447,20 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive(idevice_connecti } if (connection->ssl_data) { + uint32_t received = 0; + while (received < len) { #ifdef HAVE_OPENSSL - int received = SSL_read(connection->ssl_data->session, (void*)data, (int)len); - debug_info("SSL_read %d, received %d", len, received); + int r = SSL_read(connection->ssl_data->session, (void*)((char*)(data+received)), (int)len-received); #else - ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len); + 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; + } + } + debug_info("SSL_read %d, received %d", len, received); if (received > 0) { *recv_bytes = received; return IDEVICE_E_SUCCESS; |