summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
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
135LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const char* data, uint32_t size, uint32_t *sent) 135LIBIMOBILEDEVICE_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
156LIBIMOBILEDEVICE_API service_error_t service_receive_with_timeout(service_client_t client, char* data, uint32_t size, uint32_t *received, unsigned int timeout) 156LIBIMOBILEDEVICE_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;