when the sender gets an index of a file to send, we make sure to
send enough future file-list data relative to the new cur_flist
value before we send the data for the file transfer (ensuring that
the generator gets the data in a more timely manner), and (2) the
generator flushes the output socket after each file-list object
has completed its scan so that the sender knows in a more timely
manner that more list data is needed.
if (allowed_lull && !(++j % lull_mod))
maybe_send_keepalive();
else if (!(j % 200))
- maybe_flush_socket();
+ maybe_flush_socket(0);
}
}
if (first_flist->in_progress || first_flist->to_redo)
break;
- if (!read_batch)
+ if (!read_batch) {
write_ndx(sock_f_out, NDX_DONE);
+ maybe_flush_socket(1);
+ }
if (delete_during == 2 || !dir_tweaking) {
/* Skip directory touch-up. */
if (allowed_lull && !(i % lull_mod))
maybe_send_keepalive();
else if (!(i % 200))
- maybe_flush_socket();
+ maybe_flush_socket(0);
}
if (!inc_recurse) {
iobuf_f_out = -1;
}
-void maybe_flush_socket(void)
+void maybe_flush_socket(int important)
{
- if (iobuf_out && iobuf_out_cnt && time(NULL) - last_io_out >= 5)
+ if (iobuf_out && iobuf_out_cnt
+ && (important || time(NULL) - last_io_out >= 5))
io_flush(NORMAL_FLUSH);
}
extern struct stats stats;
extern struct file_list *cur_flist, *first_flist;
+#define FILECNT_LOOKAHEAD 1000
+
/**
* @file
*
while (1) {
if (inc_recurse)
- send_extra_file_list(f_out, 1000);
+ send_extra_file_list(f_out, FILECNT_LOOKAHEAD);
/* This call also sets cur_flist. */
ndx = read_ndx_and_attrs(f_in, f_out, &iflags,
continue;
}
+ if (inc_recurse)
+ send_extra_file_list(f_out, FILECNT_LOOKAHEAD);
+
file = cur_flist->files[ndx - cur_flist->ndx_start];
if (F_ROOTDIR(file)) {
path = F_ROOTDIR(file);