summaryrefslogtreecommitdiffstats
path: root/src/idevice.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/idevice.c')
-rw-r--r--src/idevice.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/idevice.c b/src/idevice.c
index 90b531d..06991c5 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -384,18 +384,25 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_send(idevice_connection_
384 } 384 }
385 385
386 if (connection->ssl_data) { 386 if (connection->ssl_data) {
387 uint32_t sent = 0;
388 while (sent < len) {
387#ifdef HAVE_OPENSSL 389#ifdef HAVE_OPENSSL
388 int sent = SSL_write(connection->ssl_data->session, (const void*)data, (int)len); 390 int s = SSL_write(connection->ssl_data->session, (const void*)(data+sent), (int)(len-sent));
389 debug_info("SSL_write %d, sent %d", len, sent);
390#else 391#else
391 ssize_t sent = gnutls_record_send(connection->ssl_data->session, (void*)data, (size_t)len); 392 ssize_t s = gnutls_record_send(connection->ssl_data->session, (void*)(data+sent), (size_t)(len-sent));
392#endif 393#endif
393 if ((uint32_t)sent == (uint32_t)len) { 394 if (s < 0) {
394 *sent_bytes = sent; 395 break;
395 return IDEVICE_E_SUCCESS; 396 }
397 sent += s;
396 } 398 }
397 *sent_bytes = 0; 399 debug_info("SSL_write %d, sent %d", len, sent);
398 return IDEVICE_E_SSL_ERROR; 400 if (sent < len) {
401 *sent_bytes = 0;
402 return IDEVICE_E_SSL_ERROR;
403 }
404 *sent_bytes = sent;
405 return IDEVICE_E_SUCCESS;
399 } 406 }
400 return internal_connection_send(connection, data, len, sent_bytes); 407 return internal_connection_send(connection, data, len, sent_bytes);
401} 408}