summaryrefslogtreecommitdiff
path: root/generator.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2009-12-19 10:15:15 -0800
committerWayne Davison <wayned@samba.org>2009-12-19 11:00:36 -0800
commit92d021488ec06524f7ed6a527c39f2753f4a9fd2 (patch)
tree181e28b70b8d47620557f820801b60d4c95f5f6b /generator.c
parent82b2a31a46d7c94f951b96f61c9935198f0f53f1 (diff)
downloadrsync-92d021488ec06524f7ed6a527c39f2753f4a9fd2.tar.gz
rsync-92d021488ec06524f7ed6a527c39f2753f4a9fd2.tar.bz2
rsync-92d021488ec06524f7ed6a527c39f2753f4a9fd2.zip
Improve --timeout method to take into account all I/O that is going on.
The receiving side also switches timeout handling from the receiver to the generator, which obviates the need for the sender to send any keep-alive messages at all (for protocol 31 and beyond). Given this setup, all keep-alive messages are now sent as empty MSG_DATA messages, with MSG_NOOP messages only being understood and (when necessary) acted upon to forward a keep-alive event to an older receiver. This is both safer and more compatible with older versions.
Diffstat (limited to 'generator.c')
-rw-r--r--generator.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/generator.c b/generator.c
index b5db0754..33b7ce2a 100644
--- a/generator.c
+++ b/generator.c
@@ -71,7 +71,6 @@ extern int io_error;
extern int flist_eof;
extern int allowed_lull;
extern int sock_f_out;
-extern int ignore_timeout;
extern int protocol_version;
extern int file_total;
extern int fuzzy_basis;
@@ -290,7 +289,7 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
rprintf(FINFO, "delete_in_dir(%s)\n", fbuf);
if (allowed_lull)
- maybe_send_keepalive();
+ maybe_send_keepalive(time(NULL), True);
if (io_error && !ignore_errors) {
if (already_warned)
@@ -1929,7 +1928,7 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
}
if (counter >= loopchk_limit) {
if (allowed_lull)
- maybe_send_keepalive();
+ maybe_send_keepalive(time(NULL), True);
else
maybe_flush_socket(0);
counter = 0;
@@ -2076,12 +2075,6 @@ void generate_files(int f_out, const char *local_name)
: "enabled");
}
- /* Since we often fill up the outgoing socket and then just sit around
- * waiting for the other 2 processes to do their thing, we don't want
- * to exit on a timeout. If the data stops flowing, the receiver will
- * notice that and let us know via the redo pipe (or its closing). */
- ignore_timeout = 1;
-
dflt_perms = (ACCESSPERMS & ~orig_umask);
do {
@@ -2135,7 +2128,7 @@ void generate_files(int f_out, const char *local_name)
if (i + cur_flist->ndx_start >= next_loopchk) {
if (allowed_lull)
- maybe_send_keepalive();
+ maybe_send_keepalive(time(NULL), True);
else
maybe_flush_socket(0);
next_loopchk += loopchk_limit;