From 8250d8a1c60b58f730333d9becf9881ca2b78828 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 17 Jan 2009 13:54:52 -0800 Subject: [PATCH] Fixed a hang in the inc_recurse batch-reading code. --- NEWS | 10 +++++++++- generator.c | 8 ++------ receiver.c | 10 +++++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index d9334115..35d5a47a 100644 --- a/NEWS +++ b/NEWS @@ -4,7 +4,15 @@ Changes since 3.0.5: BUG FIXES: - - ... + - Fixed a hang in the batch-reading code with incremental recursion. + + - Fixed the daemon's socket code to handle the simultaneous arrival of + multiple connections. + + - Fixed the rrsync script to avoid a server-side problem when -e is at the + start of the short options. + + - Fixed configure's erroneous use of target. ENHANCEMENTS: diff --git a/generator.c b/generator.c index 0724f188..8d944dc0 100644 --- a/generator.c +++ b/generator.c @@ -2137,10 +2137,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. */ @@ -2285,9 +2284,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 e298e8f3..1aba494c 100644 --- a/receiver.c +++ b/receiver.c @@ -386,15 +386,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; } -- 2.34.1