diff options
Diffstat (limited to 'src/idevice.c')
| -rw-r--r-- | src/idevice.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/idevice.c b/src/idevice.c index c71c49b..071d7b9 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -610,7 +610,7 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_send(idevice_connection_ | |||
| 610 | } | 610 | } |
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | static idevice_error_t socket_recv_to_idevice_error(int conn_error, uint32_t len, uint32_t received) | 613 | static inline idevice_error_t socket_recv_to_idevice_error(int conn_error, uint32_t len, uint32_t received) |
| 614 | { | 614 | { |
| 615 | if (conn_error < 0) { | 615 | if (conn_error < 0) { |
| 616 | switch (conn_error) { | 616 | switch (conn_error) { |
| @@ -669,6 +669,7 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive_timeout(idevice_ | |||
| 669 | if (connection->ssl_data) { | 669 | if (connection->ssl_data) { |
| 670 | uint32_t received = 0; | 670 | uint32_t received = 0; |
| 671 | int do_select = 1; | 671 | int do_select = 1; |
| 672 | idevice_error_t error = IDEVICE_E_SSL_ERROR; | ||
| 672 | 673 | ||
| 673 | while (received < len) { | 674 | while (received < len) { |
| 674 | #ifdef HAVE_OPENSSL | 675 | #ifdef HAVE_OPENSSL |
| @@ -676,10 +677,10 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive_timeout(idevice_ | |||
| 676 | #endif | 677 | #endif |
| 677 | if (do_select) { | 678 | if (do_select) { |
| 678 | int conn_error = socket_check_fd((int)(long)connection->data, FDM_READ, timeout); | 679 | int conn_error = socket_check_fd((int)(long)connection->data, FDM_READ, timeout); |
| 679 | idevice_error_t error = socket_recv_to_idevice_error(conn_error, len, received); | 680 | error = socket_recv_to_idevice_error(conn_error, len, received); |
| 680 | |||
| 681 | switch (error) { | 681 | switch (error) { |
| 682 | case IDEVICE_E_SUCCESS: | 682 | case IDEVICE_E_SUCCESS: |
| 683 | case IDEVICE_E_TIMEOUT: | ||
| 683 | break; | 684 | break; |
| 684 | case IDEVICE_E_UNKNOWN_ERROR: | 685 | case IDEVICE_E_UNKNOWN_ERROR: |
| 685 | default: | 686 | default: |
| @@ -687,7 +688,9 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive_timeout(idevice_ | |||
| 687 | return error; | 688 | return error; |
| 688 | } | 689 | } |
| 689 | } | 690 | } |
| 690 | 691 | if (error == IDEVICE_E_TIMEOUT) { | |
| 692 | break; | ||
| 693 | } | ||
| 691 | #ifdef HAVE_OPENSSL | 694 | #ifdef HAVE_OPENSSL |
| 692 | int r = SSL_read(connection->ssl_data->session, (void*)((char*)(data+received)), (int)len-received); | 695 | int r = SSL_read(connection->ssl_data->session, (void*)((char*)(data+received)), (int)len-received); |
| 693 | if (r > 0) { | 696 | if (r > 0) { |
| @@ -711,8 +714,8 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_receive_timeout(idevice_ | |||
| 711 | 714 | ||
| 712 | debug_info("SSL_read %d, received %d", len, received); | 715 | debug_info("SSL_read %d, received %d", len, received); |
| 713 | if (received < len) { | 716 | if (received < len) { |
| 714 | *recv_bytes = 0; | 717 | *recv_bytes = received; |
| 715 | return IDEVICE_E_SSL_ERROR; | 718 | return error; |
| 716 | } | 719 | } |
| 717 | 720 | ||
| 718 | *recv_bytes = received; | 721 | *recv_bytes = received; |
