summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-11-10 22:55:11 +0100
committerGravatar Martin Szulecki2013-11-10 22:55:11 +0100
commit3c3a791794f86d58605d1c6098c249a713af2a48 (patch)
treecd1835026ce4eef185cacf53bfe612b11d2fcb02
parenta12a053190c252498f171999cf5927d782fdbcb7 (diff)
downloadlibimobiledevice-3c3a791794f86d58605d1c6098c249a713af2a48.tar.gz
libimobiledevice-3c3a791794f86d58605d1c6098c249a713af2a48.tar.bz2
installation_proxy: Fix operations exiting before being finished due to timeout
The internal status callback used a timeout of 30 seconds to receive status messages about the progress of an operation. However, slow devices or large app archives trigger this timeout causing the handler to return before the operation was actually complete. This fixes it by removing the internal timeout by waiting forever and only returning early in case of a real error.
-rw-r--r--include/libimobiledevice/installation_proxy.h1
-rw-r--r--src/installation_proxy.c9
2 files changed, 6 insertions, 4 deletions
diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h
index 1274884..18b7804 100644
--- a/include/libimobiledevice/installation_proxy.h
+++ b/include/libimobiledevice/installation_proxy.h
@@ -40,6 +40,7 @@ extern "C" {
#define INSTPROXY_E_CONN_FAILED -3
#define INSTPROXY_E_OP_IN_PROGRESS -4
#define INSTPROXY_E_OP_FAILED -5
+#define INSTPROXY_E_RECEIVE_TIMEOUT -6
#define INSTPROXY_E_UNKNOWN_ERROR -256
/*@}*/
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index 7ee12cc..f758a14 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -2,6 +2,7 @@
* installation_proxy.c
* com.apple.mobile.installation_proxy service implementation.
*
+ * Copyright (c) 2013 Martin Szulecki All Rights Reserved.
* Copyright (c) 2009 Nikias Bassen, All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
@@ -230,7 +231,7 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_opt
browsing = 0;
dict = NULL;
res = instproxy_error(property_list_service_receive_plist(client->parent, &dict));
- if (res != INSTPROXY_E_SUCCESS) {
+ if (res != INSTPROXY_E_SUCCESS && res != INSTPROXY_E_RECEIVE_TIMEOUT) {
break;
}
if (dict) {
@@ -297,9 +298,9 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client,
do {
instproxy_lock(client);
- res = instproxy_error(property_list_service_receive_plist_with_timeout(client->parent, &dict, 30000));
+ res = instproxy_error(property_list_service_receive_plist_with_timeout(client->parent, &dict, 1000));
instproxy_unlock(client);
- if (res != INSTPROXY_E_SUCCESS) {
+ if (res != INSTPROXY_E_SUCCESS && res != INSTPROXY_E_RECEIVE_TIMEOUT) {
debug_info("could not receive plist, error %d", res);
break;
}
@@ -376,7 +377,7 @@ static void* instproxy_status_updater(void* arg)
instproxy_lock(data->client);
debug_info("done, cleaning up.");
if (data->operation) {
- free(data->operation);
+ free(data->operation);
}
data->client->status_updater = (thread_t)NULL;
instproxy_unlock(data->client);