From de9b690877c4581a4e846743efa26aa75759d074 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Mon, 25 Jan 2010 15:44:32 +0100 Subject: Also count received hunks so the total backup size message appears once --- tools/iphonebackup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/iphonebackup.c b/tools/iphonebackup.c index d444e9b..c0f2276 100644 --- a/tools/iphonebackup.c +++ b/tools/iphonebackup.c @@ -425,6 +425,7 @@ int main(int argc, char *argv[]) /* receive and save DLSendFile files and metadata, ACK each */ int file_index = 0; + int hunk_index = 0; uint64_t backup_real_size = 0; char *file_path = NULL; char *file_ext = NULL; @@ -442,8 +443,8 @@ int main(int argc, char *argv[]) node_tmp = plist_array_get_item(message, 2); - /* first message contains total backup size */ - if (file_index == 0) { + /* first message hunk contains total backup size */ + if (hunk_index == 0) { node = plist_dict_get_item(node_tmp, "BackupTotalSizeKey"); if (node) { plist_get_uint_val(node, &backup_total_size); @@ -533,6 +534,8 @@ int main(int argc, char *argv[]) printf("DONE\n"); } + hunk_index++; + if (file_ext) free(file_ext); -- cgit v1.1-32-gdbae