diff options
| author | 2020-05-21 04:36:29 +0200 | |
|---|---|---|
| committer | 2020-05-21 04:36:29 +0200 | |
| commit | 80eec8b83cca16d7a7c7cf9fc53422505cf31225 (patch) | |
| tree | 79cf434a807bd322cd4104a57231087c5c234c8b /src/idevice.c | |
| parent | 59f16a14692f7d84c5871394b8928d94b4dc34ce (diff) | |
| download | libimobiledevice-80eec8b83cca16d7a7c7cf9fc53422505cf31225.tar.gz libimobiledevice-80eec8b83cca16d7a7c7cf9fc53422505cf31225.tar.bz2 | |
idevice: [OpenSSL] Handle non-blocking SSL_write
Diffstat (limited to 'src/idevice.c')
| -rw-r--r-- | src/idevice.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/idevice.c b/src/idevice.c index 7b3625e..d3f28c2 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -549,7 +549,20 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_send(idevice_connection_ | |||
| 549 | uint32_t sent = 0; | 549 | uint32_t sent = 0; |
| 550 | while (sent < len) { | 550 | while (sent < len) { |
| 551 | #ifdef HAVE_OPENSSL | 551 | #ifdef HAVE_OPENSSL |
| 552 | int c = socket_check_fd((int)(long)connection->data, FDM_WRITE, 100); | ||
| 553 | if (c < 0) { | ||
| 554 | break; | ||
| 555 | } else if (c == 0) { | ||
| 556 | continue; | ||
| 557 | } | ||
| 552 | int s = SSL_write(connection->ssl_data->session, (const void*)(data+sent), (int)(len-sent)); | 558 | int s = SSL_write(connection->ssl_data->session, (const void*)(data+sent), (int)(len-sent)); |
| 559 | if (s <= 0) { | ||
| 560 | int sslerr = SSL_get_error(connection->ssl_data->session, s); | ||
| 561 | if (sslerr == SSL_ERROR_WANT_WRITE) { | ||
| 562 | continue; | ||
| 563 | } | ||
| 564 | break; | ||
| 565 | } | ||
| 553 | #else | 566 | #else |
| 554 | ssize_t s = gnutls_record_send(connection->ssl_data->session, (void*)(data+sent), (size_t)(len-sent)); | 567 | ssize_t s = gnutls_record_send(connection->ssl_data->session, (void*)(data+sent), (size_t)(len-sent)); |
| 555 | #endif | 568 | #endif |
