diff options
| author | 2011-04-28 19:42:21 +0200 | |
|---|---|---|
| committer | 2011-04-28 19:42:21 +0200 | |
| commit | 8ecfbc77ccaaa0c017aae5d944efec47bd2c6171 (patch) | |
| tree | dcb78b94a2098dcf5782cfc0b355df26167947e5 | |
| parent | de9cd870f92abe194904291887828fff9401d020 (diff) | |
| download | libimobiledevice-8ecfbc77ccaaa0c017aae5d944efec47bd2c6171.tar.gz libimobiledevice-8ecfbc77ccaaa0c017aae5d944efec47bd2c6171.tar.bz2 | |
idevicebackup2: Improve disconnect behavior to cleanly disconnect from agent
| -rw-r--r-- | src/mobilebackup2.c | 1 | ||||
| -rw-r--r-- | tools/idevicebackup2.c | 14 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c index a595b01..c72823e 100644 --- a/src/mobilebackup2.c +++ b/src/mobilebackup2.c | |||
| @@ -116,7 +116,6 @@ mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client) | |||
| 116 | return MOBILEBACKUP2_E_INVALID_ARG; | 116 | return MOBILEBACKUP2_E_INVALID_ARG; |
| 117 | mobilebackup2_error_t err = MOBILEBACKUP2_E_SUCCESS; | 117 | mobilebackup2_error_t err = MOBILEBACKUP2_E_SUCCESS; |
| 118 | if (client->parent) { | 118 | if (client->parent) { |
| 119 | device_link_service_disconnect(client->parent); | ||
| 120 | err = mobilebackup2_error(device_link_service_client_free(client->parent)); | 119 | err = mobilebackup2_error(device_link_service_client_free(client->parent)); |
| 121 | } | 120 | } |
| 122 | free(client); | 121 | free(client); |
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: | |||
| 1577 | if (err != MOBILEBACKUP2_E_SUCCESS) { | 1577 | if (err != MOBILEBACKUP2_E_SUCCESS) { |
| 1578 | printf("Could not send status response, error %d\n", err); | 1578 | printf("Could not send status response, error %d\n", err); |
| 1579 | } | 1579 | } |
| 1580 | } else if (!strcmp(dlmsg, "DLMessageDisconnect")) { | ||
| 1581 | break; | ||
| 1580 | } else if (!strcmp(dlmsg, "DLMessageProcessMessage")) { | 1582 | } else if (!strcmp(dlmsg, "DLMessageProcessMessage")) { |
| 1581 | node_tmp = plist_array_get_item(message, 1); | 1583 | node_tmp = plist_array_get_item(message, 1); |
| 1582 | if (plist_get_node_type(node_tmp) != PLIST_DICT) { | 1584 | if (plist_get_node_type(node_tmp) != PLIST_DICT) { |
| @@ -1616,7 +1618,11 @@ checkpoint: | |||
| 1616 | printf("%s", str); | 1618 | printf("%s", str); |
| 1617 | free(str); | 1619 | free(str); |
| 1618 | } | 1620 | } |
| 1619 | break; | 1621 | |
| 1622 | err = mobilebackup2_send_status_response(mobilebackup2, 0, NULL, plist_new_dict()); | ||
| 1623 | if (err != MOBILEBACKUP2_E_SUCCESS) { | ||
| 1624 | printf("Could not send status response, error %d\n", err); | ||
| 1625 | } | ||
| 1620 | } | 1626 | } |
| 1621 | 1627 | ||
| 1622 | /* print status */ | 1628 | /* print status */ |
| @@ -1713,15 +1719,15 @@ files_out: | |||
| 1713 | client = NULL; | 1719 | client = NULL; |
| 1714 | } | 1720 | } |
| 1715 | 1721 | ||
| 1722 | if (mobilebackup2) | ||
| 1723 | mobilebackup2_client_free(mobilebackup2); | ||
| 1724 | |||
| 1716 | if (afc) | 1725 | if (afc) |
| 1717 | afc_client_free(afc); | 1726 | afc_client_free(afc); |
| 1718 | 1727 | ||
| 1719 | if (np) | 1728 | if (np) |
| 1720 | np_client_free(np); | 1729 | np_client_free(np); |
| 1721 | 1730 | ||
| 1722 | if (mobilebackup2) | ||
| 1723 | mobilebackup2_client_free(mobilebackup2); | ||
| 1724 | |||
| 1725 | idevice_free(phone); | 1731 | idevice_free(phone); |
| 1726 | 1732 | ||
| 1727 | return 0; | 1733 | return 0; |
