diff options
| author | 2010-01-25 22:19:42 +0100 | |
|---|---|---|
| committer | 2010-01-25 22:19:42 +0100 | |
| commit | 4f5b839827625adaf444a4c5fbfd6145367da473 (patch) | |
| tree | 421cc2fc8c3902a89b54cadb4f383eabdfbadcf2 /tools/iphonebackup.c | |
| 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/iphonebackup.c')
| -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) | |||
| 176 | message = NULL; | 176 | message = NULL; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static plist_t mobilebackup_factory_backup_file_received_new() | ||
| 180 | { | ||
| 181 | plist_t node = plist_new_dict(); | ||
| 182 | plist_dict_insert_item(node, "BackupMessageTypeKey", plist_new_string("kBackupMessageBackupFileReceived")); | ||
| 183 | return device_link_message_factory_process_message_new(node); | ||
| 184 | } | ||
| 185 | |||
| 179 | static void mobilebackup_write_status(char *path, int status) | 186 | static void mobilebackup_write_status(char *path, int status) |
| 180 | { | 187 | { |
| 181 | struct stat st; | 188 | struct stat st; |
| @@ -515,36 +522,31 @@ int main(int argc, char *argv[]) | |||
| 515 | g_free(filename_mddata); | 522 | g_free(filename_mddata); |
| 516 | } | 523 | } |
| 517 | 524 | ||
| 518 | if ((c == 2) && (!is_manifest)) { | ||
| 519 | printf("DONE\n"); | ||
| 520 | } | ||
| 521 | |||
| 522 | hunk_index++; | 525 | hunk_index++; |
| 523 | 526 | ||
| 524 | if (file_ext) | 527 | if (file_ext) |
| 525 | free(file_ext); | 528 | free(file_ext); |
| 526 | 529 | ||
| 527 | plist_free(message); | 530 | if (message) |
| 531 | plist_free(message); | ||
| 528 | message = NULL; | 532 | message = NULL; |
| 529 | 533 | ||
| 530 | if (quit_flag > 0) { | 534 | if (c == 2) { |
| 531 | /* need to cancel the backup here */ | 535 | if (!is_manifest) |
| 532 | mobilebackup_cancel_backup_with_error("Cancelling DLSendFile"); | 536 | printf("DONE\n"); |
| 533 | 537 | ||
| 538 | /* acknowlegdge that we received the file */ | ||
| 539 | message = mobilebackup_factory_backup_file_received_new(); | ||
| 540 | mobilebackup_send(mobilebackup, message); | ||
| 534 | plist_free(message); | 541 | plist_free(message); |
| 535 | message = NULL; | 542 | message = NULL; |
| 536 | break; | ||
| 537 | } | 543 | } |
| 538 | 544 | ||
| 539 | /* acknowlegdge that we received the file */ | 545 | if (quit_flag > 0) { |
| 540 | node = plist_new_dict(); | 546 | /* need to cancel the backup here */ |
| 541 | plist_dict_insert_item(node, "BackupMessageTypeKey", plist_new_string("kBackupMessageBackupFileReceived")); | 547 | mobilebackup_cancel_backup_with_error("Cancelling DLSendFile"); |
| 542 | 548 | break; | |
| 543 | message = device_link_message_factory_process_message_new(node); | 549 | } |
| 544 | mobilebackup_send(mobilebackup, message); | ||
| 545 | |||
| 546 | plist_free(message); | ||
| 547 | message = NULL; | ||
| 548 | } while (1); | 550 | } while (1); |
| 549 | 551 | ||
| 550 | printf("Received %d files from device.\n", file_index); | 552 | printf("Received %d files from device.\n", file_index); |
