summaryrefslogtreecommitdiffstats
path: root/src/service.c
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/service.c
parent1369f43fd5cf06e983f6399971d64284d39c9ddd (diff)
downloadlibimobiledevice-fa1c5a9029b321adc2597bbe76920e5a7efd785b.tar.gz
libimobiledevice-fa1c5a9029b321adc2597bbe76920e5a7efd785b.tar.bz2
service: Silence timeout errors
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c16
1 files changed, 8 insertions, 8 deletions
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;