X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/20caffd2b361bcad51692998411e4cc566c04b40..554dc122f271fc361b963067fa3d80084fd7ca91:/sender.c diff --git a/sender.c b/sender.c index 621cf20f..600ad847 100644 --- a/sender.c +++ b/sender.c @@ -42,6 +42,7 @@ extern int make_backups; extern int inplace; extern int batch_fd; extern int write_batch; +extern int file_old_total; extern struct stats stats; extern struct file_list *cur_flist, *first_flist, *dir_flist; @@ -62,7 +63,7 @@ static struct sum_struct *receive_sums(int f) { struct sum_struct *s; int32 i; - int lull_mod = allowed_lull * 5; + int lull_mod = protocol_version >= 31 ? 0 : allowed_lull * 5; OFF_T offset = 0; if (!(s = new(struct sum_struct))) @@ -103,8 +104,8 @@ static struct sum_struct *receive_sums(int f) s->sums[i].len = s->blength; offset += s->sums[i].len; - if (allowed_lull && !(i % lull_mod)) - maybe_send_keepalive(); + if (lull_mod && !(i % lull_mod)) + maybe_send_keepalive(time(NULL), True); if (DEBUG_GTE(DELTASUM, 3)) { rprintf(FINFO, @@ -171,7 +172,6 @@ void send_files(int f_in, int f_out) int iflags, xlen; struct file_struct *file; int phase = 0, max_phase = protocol_version >= 29 ? 2 : 1; - struct stats initial_stats; int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i; enum logcode log_code = log_before_transfer ? FLOG : FINFO; int f_xfer = write_batch < 0 ? batch_fd : f_out; @@ -198,8 +198,11 @@ void send_files(int f_in, int f_out) end_progress(0); } if (inc_recurse && first_flist) { + file_old_total -= first_flist->used; flist_free(first_flist); if (first_flist) { + if (first_flist == cur_flist) + file_old_total = cur_flist->used; write_ndx(f_out, NDX_DONE); continue; } @@ -291,15 +294,16 @@ void send_files(int f_in, int f_out) stats.xferred_files++; stats.total_transferred_size += F_LENGTH(file); + if (!log_before_transfer) + remember_initial_stats(); + if (!do_xfers) { /* log the transfer */ - log_item(FCLIENT, file, &stats, iflags, NULL); + log_item(FCLIENT, file, iflags, NULL); write_ndx_and_attrs(f_out, ndx, iflags, fname, file, fnamecmp_type, xname, xlen); continue; } - initial_stats = stats; - if (!(s = receive_sums(f_in))) { io_error |= IOERR_GENERAL; rprintf(FERROR_XFER, "receive_sums failed\n"); @@ -333,7 +337,7 @@ void send_files(int f_in, int f_out) rsyserr(FERROR_XFER, errno, "fstat failed"); free_sums(s); close(fd); - exit_cleanup(RERR_PROTOCOL); + exit_cleanup(RERR_FILEIO); } if (st.st_size) { @@ -355,7 +359,7 @@ void send_files(int f_in, int f_out) rprintf(FINFO, "calling match_sums %s%s%s\n", path,slash,fname); if (log_before_transfer) - log_item(FCLIENT, file, &initial_stats, iflags, NULL); + log_item(FCLIENT, file, iflags, NULL); else if (!am_server && INFO_GTE(NAME, 1) && INFO_EQ(PROGRESS, 1)) rprintf(FCLIENT, "%s\n", fname); @@ -365,7 +369,7 @@ void send_files(int f_in, int f_out) if (INFO_GTE(PROGRESS, 1)) end_progress(st.st_size); - log_item(log_code, file, &initial_stats, iflags, NULL); + log_item(log_code, file, iflags, NULL); if (mbuf) { j = unmap_file(mbuf);