summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup2.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2011-04-28 19:42:21 +0200
committerGravatar Martin Szulecki2011-04-28 19:42:21 +0200
commit8ecfbc77ccaaa0c017aae5d944efec47bd2c6171 (patch)
treedcb78b94a2098dcf5782cfc0b355df26167947e5 /tools/idevicebackup2.c
parentde9cd870f92abe194904291887828fff9401d020 (diff)
downloadlibimobiledevice-8ecfbc77ccaaa0c017aae5d944efec47bd2c6171.tar.gz
libimobiledevice-8ecfbc77ccaaa0c017aae5d944efec47bd2c6171.tar.bz2
idevicebackup2: Improve disconnect behavior to cleanly disconnect from agent
Diffstat (limited to 'tools/idevicebackup2.c')
-rw-r--r--tools/idevicebackup2.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 442ce14..47dd4f2 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -1577,6 +1577,8 @@ checkpoint:
if (err != MOBILEBACKUP2_E_SUCCESS) {
printf("Could not send status response, error %d\n", err);
}
+ } else if (!strcmp(dlmsg, "DLMessageDisconnect")) {
+ break;
} else if (!strcmp(dlmsg, "DLMessageProcessMessage")) {
node_tmp = plist_array_get_item(message, 1);
if (plist_get_node_type(node_tmp) != PLIST_DICT) {
@@ -1616,7 +1618,11 @@ checkpoint:
printf("%s", str);
free(str);
}
- break;
+
+ err = mobilebackup2_send_status_response(mobilebackup2, 0, NULL, plist_new_dict());
+ if (err != MOBILEBACKUP2_E_SUCCESS) {
+ printf("Could not send status response, error %d\n", err);
+ }
}
/* print status */
@@ -1713,15 +1719,15 @@ files_out:
client = NULL;
}
+ if (mobilebackup2)
+ mobilebackup2_client_free(mobilebackup2);
+
if (afc)
afc_client_free(afc);
if (np)
np_client_free(np);
- if (mobilebackup2)
- mobilebackup2_client_free(mobilebackup2);
-
idevice_free(phone);
return 0;