diff options
| author | 2019-06-16 01:24:19 +0200 | |
|---|---|---|
| committer | 2019-06-16 01:24:19 +0200 | |
| commit | fa1c5a9029b321adc2597bbe76920e5a7efd785b (patch) | |
| tree | bdf63a904924494ac481b1beb40b0f42a5b326a3 | |
| parent | 1369f43fd5cf06e983f6399971d64284d39c9ddd (diff) | |
| download | libimobiledevice-fa1c5a9029b321adc2597bbe76920e5a7efd785b.tar.gz libimobiledevice-fa1c5a9029b321adc2597bbe76920e5a7efd785b.tar.bz2 | |
service: Silence timeout errors
| -rw-r--r-- | src/idevice.c | 1 | ||||
| -rw-r--r-- | src/service.c | 16 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/idevice.c b/src/idevice.c index 5d5c950..745d784 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -390,7 +390,6 @@ static idevice_error_t socket_recv_to_idevice_error(int conn_error, uint32_t len | |||
| 390 | debug_info("ERROR: received partial data %d/%d (%s)", received, len, strerror(-conn_error)); | 390 | debug_info("ERROR: received partial data %d/%d (%s)", received, len, strerror(-conn_error)); |
| 391 | return IDEVICE_E_NOT_ENOUGH_DATA; | 391 | return IDEVICE_E_NOT_ENOUGH_DATA; |
| 392 | case -ETIMEDOUT: | 392 | case -ETIMEDOUT: |
| 393 | debug_info("ERROR: received timeout (%s)", strerror(-conn_error)); | ||
| 394 | return IDEVICE_E_TIMEOUT; | 393 | return IDEVICE_E_TIMEOUT; |
| 395 | default: | 394 | default: |
| 396 | return IDEVICE_E_UNKNOWN_ERROR; | 395 | return IDEVICE_E_UNKNOWN_ERROR; |
diff --git a/src/service.c b/src/service.c index 661c4f6..091b599 100644 --- a/src/service.c +++ b/src/service.c | |||
| @@ -135,19 +135,19 @@ LIBIMOBILEDEVICE_API service_error_t service_client_free(service_client_t client | |||
| 135 | LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const char* data, uint32_t size, uint32_t *sent) | 135 | LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const char* data, uint32_t size, uint32_t *sent) |
| 136 | { | 136 | { |
| 137 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; | 137 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; |
| 138 | int bytes = 0; | 138 | uint32_t bytes = 0; |
| 139 | 139 | ||
| 140 | if (!client || (client && !client->connection) || !data || (size == 0)) { | 140 | if (!client || (client && !client->connection) || !data || (size == 0)) { |
| 141 | return SERVICE_E_INVALID_ARG; | 141 | return SERVICE_E_INVALID_ARG; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | debug_info("sending %d bytes", size); | 144 | debug_info("sending %d bytes", size); |
| 145 | res = idevice_to_service_error(idevice_connection_send(client->connection, data, size, (uint32_t*)&bytes)); | 145 | res = idevice_to_service_error(idevice_connection_send(client->connection, data, size, &bytes)); |
| 146 | if (bytes <= 0) { | 146 | if (res != SERVICE_E_SUCCESS) { |
| 147 | debug_info("ERROR: sending to device failed."); | 147 | debug_info("ERROR: sending to device failed."); |
| 148 | } | 148 | } |
| 149 | if (sent) { | 149 | if (sent) { |
| 150 | *sent = (uint32_t)bytes; | 150 | *sent = bytes; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | return res; | 153 | return res; |
| @@ -156,19 +156,19 @@ LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const | |||
| 156 | LIBIMOBILEDEVICE_API service_error_t service_receive_with_timeout(service_client_t client, char* data, uint32_t size, uint32_t *received, unsigned int timeout) | 156 | LIBIMOBILEDEVICE_API service_error_t service_receive_with_timeout(service_client_t client, char* data, uint32_t size, uint32_t *received, unsigned int timeout) |
| 157 | { | 157 | { |
| 158 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; | 158 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; |
| 159 | int bytes = 0; | 159 | uint32_t bytes = 0; |
| 160 | 160 | ||
| 161 | if (!client || (client && !client->connection) || !data || (size == 0)) { | 161 | if (!client || (client && !client->connection) || !data || (size == 0)) { |
| 162 | return SERVICE_E_INVALID_ARG; | 162 | return SERVICE_E_INVALID_ARG; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | res = idevice_to_service_error(idevice_connection_receive_timeout(client->connection, data, size, (uint32_t*)&bytes, timeout)); | 165 | res = idevice_to_service_error(idevice_connection_receive_timeout(client->connection, data, size, &bytes, timeout)); |
| 166 | if (res != SERVICE_E_SUCCESS) { | 166 | if (res != SERVICE_E_SUCCESS && res != SERVICE_E_TIMEOUT) { |
| 167 | debug_info("could not read data"); | 167 | debug_info("could not read data"); |
| 168 | return res; | 168 | return res; |
| 169 | } | 169 | } |
| 170 | if (received) { | 170 | if (received) { |
| 171 | *received = (uint32_t)bytes; | 171 | *received = bytes; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | return res; | 174 | return res; |
