From: Wayne Davison Date: Wed, 16 Dec 2009 21:32:03 +0000 (-0800) Subject: Use 0-length MSG_DATA when MSG_NOOP is not available X-Git-Tag: v3.0.7pre1~8 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=bdc038fce0ae9f0cb83b579608e3a244703f8cc7;p=rsync.git Use 0-length MSG_DATA when MSG_NOOP is not available (is both safer and supports older rsyncs). --- diff --git a/NEWS b/NEWS index 186f872f..a6cc1a4e 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Changes since 3.0.6: - Avoid an error when --dry-run was trying to stat a prior hard-link file that hasn't really been created. - - Improved --skip-compress's error handling of bad character sets and got + - Improved --skip-compress's error handling of bad character-sets and got rid of a lingering debug fprintf(). - Fixed the daemon's conveyance of io_error value from the sender. @@ -21,6 +21,9 @@ Changes since 3.0.6: - Improved the "--delete does not work without -r or -d" message. + - Tweaked the sending of NOOP messages (which try to prevent a timeout) to + work with older protocols (supporting rsync 2.6.3 and older). + - Some misc manpage improvements. - Fixed the chmod-temp-dir testsuite on a system without /var/tmp. @@ -38,8 +41,13 @@ Changes since 3.0.6: - Made our (only used if missing) getaddrinfo() routine use inet_pton() (which we also provide) instead of inet_aton(). + - The exit-related debug messages now mention the program's role so it is + clear who output what message. + DEVELOPER RELATED: - Got rid of type-punned compiler warnings output by newer gcc versions. - The Makefile now ensures that proto.h will be rebuilt if config.h changes. + + - The testsuite no longer uses "id -u", so it works better on solaris. diff --git a/io.c b/io.c index 4a00992c..7675d349 100644 --- a/io.c +++ b/io.c @@ -949,14 +949,10 @@ void maybe_send_keepalive(void) { if (time(NULL) - last_io_out >= allowed_lull) { if (!iobuf_out || !iobuf_out_cnt) { - if (protocol_version < 29) - return; /* there's nothing we can do */ if (protocol_version >= 30) send_msg(MSG_NOOP, "", 0, 0); - else { - write_int(sock_f_out, cur_flist->used); - write_shortint(sock_f_out, ITEM_IS_NEW); - } + else + send_msg(MSG_DATA, "", 0, 0); } if (iobuf_out) io_flush(NORMAL_FLUSH);