extern int preserve_times;
extern int omit_dir_times;
extern int delete_during;
+extern int remove_sent_files;
extern int update_only;
extern int opt_ignore_existing;
extern int inplace;
extern int size_only;
extern OFF_T max_size;
extern int io_timeout;
+extern int ignore_timeout;
extern int protocol_version;
extern int fuzzy_basis;
extern int always_checksum;
#define SID_UPDATING ITEM_UPDATING
#define SID_REPORT_CHECKSUM ITEM_REPORT_CHECKSUM
+#define SID_USING_ALT_BASIS ITEM_USING_ALT_BASIS
+/* This flag doesn't get sent, so it must be outside 0xffff. */
#define SID_NO_DEST_AND_NO_UPDATE (1<<16)
static void itemize(struct file_struct *file, int statret, STRUCT_STAT *st,
int32 sflags, int f_out, int ndx)
{
- int iflags = sflags & (SID_UPDATING | SID_REPORT_CHECKSUM);
+ int iflags = sflags & 0xffff;
if (statret >= 0) {
if (S_ISREG(file->mode) && file->length != st->st_size)
rprintf(code, "%s -> %s\n", safe_fname(fname),
safe_fname(file->u.link));
}
+ if (remove_sent_files && !dry_run) {
+ char numbuf[4];
+ SIVAL(numbuf, 0, ndx);
+ send_msg(MSG_SUCCESS, numbuf, 4);
+ }
}
#endif
return;
notify_others:
write_int(f_out, ndx);
if (itemizing) {
- itemize(file, statret, &st, SID_UPDATING
- | (always_checksum ? SID_REPORT_CHECKSUM : 0),
- f_out, -1);
- if (inplace && !read_batch)
- write_byte(f_out, fnamecmp_type);
+ int iflags = SID_UPDATING;
+ if (always_checksum)
+ iflags |= SID_REPORT_CHECKSUM;
+ if (fnamecmp_type != FNAMECMP_FNAME)
+ iflags |= SID_USING_ALT_BASIS;
+ itemize(file, statret, &st, iflags, f_out, -1);
}
if (f_out_name >= 0) {
write_byte(f_out_name, fnamecmp_type);
#endif
}
*lb = len;
- write_buf(f_out_name, lenbuf, lb - lenbuf + 1);
+ write_buf(f_out_name, (char*)lenbuf, lb - lenbuf + 1);
write_buf(f_out_name, fuzzy_file->basename, len);
}
}
int need_retouch_dir_perms = 0;
int save_only_existing = only_existing;
int save_opt_ignore_existing = opt_ignore_existing;
+ int allowed_lull = protocol_version >= 29 ? io_timeout / 2 : 0;
if (verbose > 2) {
rprintf(FINFO, "generator starting pid=%ld count=%d\n",
}
if (verbose >= 2) {
- rprintf(FINFO,
+ rprintf(FINFO, "delta-transmission %s\n",
whole_file > 0
- ? "delta-transmission disabled for local transfer or --whole-file\n"
- : "delta transmission enabled\n");
+ ? "disabled for local transfer or --whole-file"
+ : "enabled");
}
- /* We expect to just sit around now, so don't exit on a timeout.
- * If we really get a timeout then the other process should exit. */
- io_timeout = 0;
+ if (protocol_version < 29)
+ io_timeout = 0; /* kluge for older protocol versions */
for (i = 0; i < flist->count; i++) {
struct file_struct *file = flist->files[i];
recv_generator(local_name ? local_name : f_name_to(file, fbuf),
flist, file, i, f_out, f_out_name);
+
+ if (allowed_lull && !(i % 100))
+ maybe_send_keepalive(allowed_lull, flist->count);
}
recv_generator(NULL, NULL, NULL, 0, -1, -1);
if (delete_during)
update_only = always_checksum = size_only = 0;
ignore_times = 1;
+ /* We expect to just sit around now, so don't exit on a timeout.
+ * If we really get a timeout then the other process should exit. */
+ ignore_timeout = 1;
+
if (verbose > 2)
rprintf(FINFO,"generate_files phase=%d\n",phase);
struct file_struct *file = flist->files[i];
recv_generator(local_name ? local_name : f_name_to(file, fbuf),
flist, file, i, f_out, f_out_name);
+ if (allowed_lull)
+ maybe_send_keepalive(allowed_lull, flist->count);
}
phase++;