if (got_eof)
return 0;
+ /* TODO: integrate gen-reading I/O into perform_io() so this is not needed? */
+ io_flush(FULL_FLUSH);
+
while (next_ndx < desired_ndx) {
if (inc_recurse && flist_num <= done_cnt)
return 0;
* main routine for receiver process.
*
* Receiver process runs on the same host as the generator process. */
-int recv_files(int f_in, char *local_name)
+int recv_files(int f_in, int f_out, char *local_name)
{
int fd1,fd2;
STRUCT_STAT st;
char fnamecmpbuf[MAXPATHLEN];
uchar fnamecmp_type;
struct file_struct *file;
- 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 max_phase = protocol_version >= 29 ? 2 : 1;
cleanup_disable();
/* This call also sets cur_flist. */
- ndx = read_ndx_and_attrs(f_in, &iflags, &fnamecmp_type,
+ ndx = read_ndx_and_attrs(f_in, f_out, &iflags, &fnamecmp_type,
xname, &xlen);
if (ndx == NDX_DONE) {
if (!am_server && INFO_GTE(PROGRESS, 2) && cur_flist) {
rprintf(FINFO, "recv_files phase=%d\n", phase);
if (phase == 2 && delay_updates)
handle_delayed_updates(local_name);
- send_msg(MSG_DONE, "", 0, 0);
+ write_int(f_out, NDX_DONE);
continue;
}
}
}
+ 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);
if (read_batch)
discard_receive_data(f_in, F_LENGTH(file));
continue;
}
if (write_batch < 0) {
- log_item(FCLIENT, file, &stats, iflags, NULL);
+ log_item(FCLIENT, file, iflags, NULL);
if (!am_server)
discard_receive_data(f_in, F_LENGTH(file));
continue;
fnamecmp = fname;
}
- initial_stats = stats;
-
/* open the file */
fd1 = do_open(fnamecmp, O_RDONLY, 0);
/* log the transfer */
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(FINFO, "%s\n", fname);
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
fname, fd2, F_LENGTH(file));
- log_item(log_code, file, &initial_stats, iflags, NULL);
+ log_item(log_code, file, iflags, NULL);
if (fd1 != -1)
close(fd1);