summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-06-16 01:24:19 +0200
committerGravatar Nikias Bassen2019-06-16 01:24:19 +0200
commitfa1c5a9029b321adc2597bbe76920e5a7efd785b (patch)
treebdf63a904924494ac481b1beb40b0f42a5b326a3 /src
parent1369f43fd5cf06e983f6399971d64284d39c9ddd (diff)
downloadlibimobiledevice-fa1c5a9029b321adc2597bbe76920e5a7efd785b.tar.gz
libimobiledevice-fa1c5a9029b321adc2597bbe76920e5a7efd785b.tar.bz2
service: Silence timeout errors
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c1
-rw-r--r--src/service.c16
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
debug_info("ERROR: received partial data %d/%d (%s)", received, len, strerror(-conn_error));
return IDEVICE_E_NOT_ENOUGH_DATA;
case -ETIMEDOUT:
- debug_info("ERROR: received timeout (%s)", strerror(-conn_error));
return IDEVICE_E_TIMEOUT;
default:
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
LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const char* data, uint32_t size, uint32_t *sent)
{
service_error_t res = SERVICE_E_UNKNOWN_ERROR;
- int bytes = 0;
+ uint32_t bytes = 0;
if (!client || (client && !client->connection) || !data || (size == 0)) {
return SERVICE_E_INVALID_ARG;
}
debug_info("sending %d bytes", size);
- res = idevice_to_service_error(idevice_connection_send(client->connection, data, size, (uint32_t*)&bytes));
- if (bytes <= 0) {
+ res = idevice_to_service_error(idevice_connection_send(client->connection, data, size, &bytes));
+ if (res != SERVICE_E_SUCCESS) {
debug_info("ERROR: sending to device failed.");
}
if (sent) {
- *sent = (uint32_t)bytes;
+ *sent = bytes;
}
return res;
@@ -156,19 +156,19 @@ LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const
LIBIMOBILEDEVICE_API service_error_t service_receive_with_timeout(service_client_t client, char* data, uint32_t size, uint32_t *received, unsigned int timeout)
{
service_error_t res = SERVICE_E_UNKNOWN_ERROR;
- int bytes = 0;
+ uint32_t bytes = 0;
if (!client || (client && !client->connection) || !data || (size == 0)) {
return SERVICE_E_INVALID_ARG;
}
- res = idevice_to_service_error(idevice_connection_receive_timeout(client->connection, data, size, (uint32_t*)&bytes, timeout));
- if (res != SERVICE_E_SUCCESS) {
+ res = idevice_to_service_error(idevice_connection_receive_timeout(client->connection, data, size, &bytes, timeout));
+ if (res != SERVICE_E_SUCCESS && res != SERVICE_E_TIMEOUT) {
debug_info("could not read data");
return res;
}
if (received) {
- *received = (uint32_t)bytes;
+ *received = bytes;
}
return res;