The branch, master has been updated via f60bd811 Use MSG_FLUSH in a couple more spots. via cd0637a9 Merge pull request #2 from benrubson/flush via 32fe5fbc Correctly send last error to sender from 8809f65b A couple minor tweaks.
https://git.samba.org/?p=rsync.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit f60bd811e9cbfa3e75ac59b46fce5744278f1204 Author: Wayne Davison <wa...@opencoder.net> Date: Thu May 28 00:41:39 2020 -0700 Use MSG_FLUSH in a couple more spots. commit cd0637a9530b3e3c8713e69c39276ae4adcca0e8 Merge: 8809f65b 32fe5fbc Author: Wayne Davison <wa...@opencoder.net> Date: Wed May 27 23:35:25 2020 -0700 Merge pull request #2 from benrubson/flush Help final error messages get to the sender. Is particularly helpful when talking with an older rsync client. Adds a new flush type of MSG_FLUSH. commit 32fe5fbc114d0bd9b49eec6f1e8be0ebe649df6c Author: benrubson <6764151+benrub...@users.noreply.github.com> Date: Tue May 26 16:24:30 2020 +0200 Correctly send last error to sender ----------------------------------------------------------------------- Summary of changes: cleanup.c | 21 ++++++++++++++------- clientserver.c | 2 +- io.c | 7 ++++--- options.c | 2 +- rsync.h | 1 + 5 files changed, 21 insertions(+), 12 deletions(-) Changeset truncated at 500 lines: diff --git a/cleanup.c b/cleanup.c index fbf7c60b..b477e660 100644 --- a/cleanup.c +++ b/cleanup.c @@ -26,6 +26,7 @@ extern int dry_run; extern int am_server; extern int am_daemon; extern int am_receiver; +extern int am_sender; extern int io_error; extern int keep_partial; extern int got_xfer_error; @@ -238,15 +239,21 @@ NORETURN void _exit_cleanup(int code, const char *file, int line) switch_step++; if (exit_code && exit_code != RERR_SOCKETIO && exit_code != RERR_STREAMIO && exit_code != RERR_SIGNAL1 - && exit_code != RERR_TIMEOUT && !shutting_down && (protocol_version >= 31 || am_receiver)) { - if (line > 0) { - if (DEBUG_GTE(EXIT, 3)) { - rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT with exit_code %d\n", - who_am_i(), exit_code); + && exit_code != RERR_TIMEOUT && !shutting_down) { + if (protocol_version >= 31 || am_receiver) { + if (line > 0) { + if (DEBUG_GTE(EXIT, 3)) { + rprintf(FINFO, "[%s] sending MSG_ERROR_EXIT with exit_code %d\n", + who_am_i(), exit_code); + } + send_msg_int(MSG_ERROR_EXIT, exit_code); } - send_msg_int(MSG_ERROR_EXIT, exit_code); + if (!am_sender) + io_flush(MSG_FLUSH); /* Be sure to send all messages */ + noop_io_until_death(); } - noop_io_until_death(); + else if (!am_sender) + io_flush(MSG_FLUSH); /* Be sure to send all messages */ } #include "case_N.h" diff --git a/clientserver.c b/clientserver.c index e5a631a3..a6c24cf3 100644 --- a/clientserver.c +++ b/clientserver.c @@ -965,7 +965,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char } if (*err_msg) rprintf(FERROR, "%s\n", err_msg); - io_flush(FULL_FLUSH); + io_flush(MSG_FLUSH); } else option_error(); msleep(400); diff --git a/io.c b/io.c index 01d6152f..e6cfbbda 100644 --- a/io.c +++ b/io.c @@ -1982,13 +1982,14 @@ static void sleep_for_bwlimit(int bytes_written) total_written = (sleep_usec - elapsed_usec) * bwlimit / (ONE_SEC/1024); } -void io_flush(int flush_it_all) +void io_flush(int flush_type) { if (iobuf.out.len > iobuf.out_empty_len) { - if (flush_it_all) /* FULL_FLUSH: flush everything in the output buffers */ + if (flush_type == FULL_FLUSH) /* flush everything in the output buffers */ perform_io(iobuf.out.size - iobuf.out_empty_len, PIO_NEED_OUTROOM); - else /* NORMAL_FLUSH: flush at least 1 byte */ + else if (flush_type == NORMAL_FLUSH) /* flush at least 1 byte */ perform_io(iobuf.out.size - iobuf.out.len + 1, PIO_NEED_OUTROOM); + /* MSG_FLUSH: flush iobuf.msg only */ } if (iobuf.msg.len) perform_io(iobuf.msg.size, PIO_NEED_MSGROOM); diff --git a/options.c b/options.c index 1650780e..6a7e7aac 100644 --- a/options.c +++ b/options.c @@ -1200,7 +1200,7 @@ void option_error(void) } rprintf(FERROR, RSYNC_NAME ": %s", err_buf); - io_flush(FULL_FLUSH); + io_flush(MSG_FLUSH); msleep(20); } diff --git a/rsync.h b/rsync.h index 210cef40..06f6d338 100644 --- a/rsync.h +++ b/rsync.h @@ -178,6 +178,7 @@ #define ATTRS_SET_NANO (1<<2) #define ATTRS_SKIP_ATIME (1<<3) +#define MSG_FLUSH 2 #define FULL_FLUSH 1 #define NORMAL_FLUSH 0 -- The rsync repository. _______________________________________________ rsync-cvs mailing list rsync-cvs@lists.samba.org https://lists.samba.org/mailman/listinfo/rsync-cvs