summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-05-21 04:36:29 +0200
committerGravatar Nikias Bassen2020-05-21 04:36:29 +0200
commit80eec8b83cca16d7a7c7cf9fc53422505cf31225 (patch)
tree79cf434a807bd322cd4104a57231087c5c234c8b /src
parent59f16a14692f7d84c5871394b8928d94b4dc34ce (diff)
downloadlibimobiledevice-80eec8b83cca16d7a7c7cf9fc53422505cf31225.tar.gz
libimobiledevice-80eec8b83cca16d7a7c7cf9fc53422505cf31225.tar.bz2
idevice: [OpenSSL] Handle non-blocking SSL_write
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c13
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_
uint32_t sent = 0;
while (sent < len) {
#ifdef HAVE_OPENSSL
+ int c = socket_check_fd((int)(long)connection->data, FDM_WRITE, 100);
+ if (c < 0) {
+ break;
+ } else if (c == 0) {
+ continue;
+ }
int s = SSL_write(connection->ssl_data->session, (const void*)(data+sent), (int)(len-sent));
+ if (s <= 0) {
+ int sslerr = SSL_get_error(connection->ssl_data->session, s);
+ if (sslerr == SSL_ERROR_WANT_WRITE) {
+ continue;
+ }
+ break;
+ }
#else
ssize_t s = gnutls_record_send(connection->ssl_data->session, (void*)(data+sent), (size_t)(len-sent));
#endif