aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2009-01-17 13:54:52 -0800
committerWayne Davison <wayned@samba.org>2009-01-17 13:59:08 -0800
commit4079d6a68495a837057f5171b26e45308e9e5681 (patch)
treed4d66946f506127ab6a87f1d2d287bda6cc3a874
parentdf694f72ed3faf6d0738f95f9539dfde970ffcf9 (diff)
downloadandroid_external_rsync-4079d6a68495a837057f5171b26e45308e9e5681.tar.gz
android_external_rsync-4079d6a68495a837057f5171b26e45308e9e5681.tar.bz2
android_external_rsync-4079d6a68495a837057f5171b26e45308e9e5681.zip
Fixed a hang in the inc_recurse batch-reading code.
-rw-r--r--generator.c8
-rw-r--r--receiver.c10
2 files changed, 11 insertions, 7 deletions
diff --git a/generator.c b/generator.c
index 06279565..6b127206 100644
--- a/generator.c
+++ b/generator.c
@@ -1937,10 +1937,9 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
if (first_flist->in_progress || first_flist->to_redo)
break;
- if (!read_batch) {
- write_ndx(sock_f_out, NDX_DONE);
+ write_ndx(sock_f_out, NDX_DONE);
+ if (!read_batch)
maybe_flush_socket(1);
- }
if (delete_during == 2 || !dir_tweaking) {
/* Skip directory touch-up. */
@@ -2086,9 +2085,6 @@ void generate_files(int f_out, const char *local_name)
}
} while ((cur_flist = cur_flist->next) != NULL);
- if (read_batch && inc_recurse)
- write_ndx(f_out, NDX_DONE);
-
if (delete_during)
delete_in_dir(NULL, NULL, &dev_zero);
phase++;
diff --git a/receiver.c b/receiver.c
index 0135e426..cd24320d 100644
--- a/receiver.c
+++ b/receiver.c
@@ -387,15 +387,23 @@ static int we_want_redo(int desired_ndx)
static int gen_wants_ndx(int desired_ndx)
{
static int next_ndx = -1;
- static BOOL got_eof = 0;
+ static int done_cnt = 0;
+ static BOOL got_eof = False;
+ int flist_num = first_flist->flist_num;
if (got_eof)
return 0;
while (next_ndx < desired_ndx) {
+ if (inc_recurse && flist_num <= done_cnt)
+ return 0;
if (next_ndx >= 0)
no_batched_update(next_ndx, False);
if ((next_ndx = read_int(batch_gen_fd)) < 0) {
+ if (inc_recurse) {
+ done_cnt++;
+ continue;
+ }
got_eof = True;
return 0;
}