diff options
author | Martin Szulecki | 2010-01-25 22:19:42 +0100 |
---|---|---|
committer | Martin Szulecki | 2010-01-25 22:19:42 +0100 |
commit | 4f5b839827625adaf444a4c5fbfd6145367da473 (patch) | |
tree | 421cc2fc8c3902a89b54cadb4f383eabdfbadcf2 /tools | |
parent | 16a17385369696c69cdcbb40042515c6c0b211d5 (diff) | |
download | libimobiledevice-4f5b839827625adaf444a4c5fbfd6145367da473.tar.gz libimobiledevice-4f5b839827625adaf444a4c5fbfd6145367da473.tar.bz2 |
Do not send BackupFileReceived on every hunk, rather the last hunk of a file
This hammered the device with BackupFileReceived messages and caused the
backup to fail in the middle of the backup process.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/iphonebackup.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/tools/iphonebackup.c b/tools/iphonebackup.c index c24c161..19acc4e 100644 --- a/tools/iphonebackup.c +++ b/tools/iphonebackup.c @@ -176,6 +176,13 @@ static void mobilebackup_cancel_backup_with_error(const char *reason) message = NULL; } +static plist_t mobilebackup_factory_backup_file_received_new() +{ + plist_t node = plist_new_dict(); + plist_dict_insert_item(node, "BackupMessageTypeKey", plist_new_string("kBackupMessageBackupFileReceived")); + return device_link_message_factory_process_message_new(node); +} + static void mobilebackup_write_status(char *path, int status) { struct stat st; @@ -515,36 +522,31 @@ int main(int argc, char *argv[]) g_free(filename_mddata); } - if ((c == 2) && (!is_manifest)) { - printf("DONE\n"); - } - hunk_index++; if (file_ext) free(file_ext); - plist_free(message); + if (message) + plist_free(message); message = NULL; - if (quit_flag > 0) { - /* need to cancel the backup here */ - mobilebackup_cancel_backup_with_error("Cancelling DLSendFile"); + if (c == 2) { + if (!is_manifest) + printf("DONE\n"); + /* acknowlegdge that we received the file */ + message = mobilebackup_factory_backup_file_received_new(); + mobilebackup_send(mobilebackup, message); plist_free(message); message = NULL; - break; } - /* acknowlegdge that we received the file */ - node = plist_new_dict(); - plist_dict_insert_item(node, "BackupMessageTypeKey", plist_new_string("kBackupMessageBackupFileReceived")); - - message = device_link_message_factory_process_message_new(node); - mobilebackup_send(mobilebackup, message); - - plist_free(message); - message = NULL; + if (quit_flag > 0) { + /* need to cancel the backup here */ + mobilebackup_cancel_backup_with_error("Cancelling DLSendFile"); + break; + } } while (1); printf("Received %d files from device.\n", file_index); |