void reduce_iobuf_size(xbuf *out, size_t new_size)
{
if (new_size < out->size) {
- if (DEBUG_GTE(IO, 4)) {
+ /* Avoid weird buffer interactions by only outputting this to stderr. */
+ if (msgs2stderr && DEBUG_GTE(IO, 4)) {
const char *name = out == &iobuf.out ? "iobuf.out"
: out == &iobuf.msg ? "iobuf.msg"
: NULL;
{
if (IOBUF_WAS_REDUCED(out->size)) {
size_t new_size = IOBUF_RESTORE_SIZE(out->size);
- if (DEBUG_GTE(IO, 4)) {
+ /* Avoid weird buffer interactions by only outputting this to stderr. */
+ if (msgs2stderr && DEBUG_GTE(IO, 4)) {
const char *name = out == &iobuf.out ? "iobuf.out"
: out == &iobuf.msg ? "iobuf.msg"
: NULL;
exit_cleanup(RERR_PROTOCOL);
}
- if (DEBUG_GTE(IO, 3)) {
+ if (msgs2stderr && DEBUG_GTE(IO, 3)) {
rprintf(FINFO, "[%s] perform_io(%ld, %sinput)\n",
who_am_i(), (long)needed, flags & PIO_CONSUME_INPUT ? "consume&" : "");
}
exit_cleanup(RERR_PROTOCOL);
}
- if (DEBUG_GTE(IO, 3)) {
+ if (msgs2stderr && DEBUG_GTE(IO, 3)) {
rprintf(FINFO, "[%s] perform_io(%ld, outroom) needs to flush %ld\n",
who_am_i(), (long)needed,
iobuf.out.len + needed > iobuf.out.size
exit_cleanup(RERR_PROTOCOL);
}
- if (DEBUG_GTE(IO, 3)) {
+ if (msgs2stderr && DEBUG_GTE(IO, 3)) {
rprintf(FINFO, "[%s] perform_io(%ld, msgroom) needs to flush %ld\n",
who_am_i(), (long)needed,
iobuf.msg.len + needed > iobuf.msg.size
break;
case 0:
- if (DEBUG_GTE(IO, 3))
+ if (msgs2stderr && DEBUG_GTE(IO, 3))
rprintf(FINFO, "[%s] perform_io(%ld, %d)\n", who_am_i(), (long)needed, flags);
break;
SIVAL(iobuf.out.buf + iobuf.raw_data_header_pos, 0,
((MPLEX_BASE + (int)MSG_DATA)<<24) + iobuf.out.len - 4);
- if (DEBUG_GTE(IO, 1)) {
+ if (msgs2stderr && DEBUG_GTE(IO, 1)) {
rprintf(FINFO, "[%s] send_msg(%d, %ld)\n",
who_am_i(), (int)MSG_DATA, (long)iobuf.out.len - 4);
}
}
if (extra_flist_sending_enabled) {
- if (file_total - file_old_total < MAX_FILECNT_LOOKAHEAD)
+ if (file_total - file_old_total < MAX_FILECNT_LOOKAHEAD && IN_MULTIPLEXED_AND_READY)
tv.tv_sec = 0;
else {
extra_flist_sending_enabled = False;
exit_cleanup(RERR_STREAMIO);
}
raw_read_buf(data, msg_bytes);
- iobuf.in_multiplexed = 1;
+ /* We don't set in_multiplexed value back to 1 before writing this message
+ * because the write might loop back and read yet another message, over and
+ * over again, while waiting for room to put the message in the msg buffer. */
rwrite((enum logcode)tag, data, msg_bytes, !am_generator);
+ iobuf.in_multiplexed = 1;
if (first_message) {
if (list_only && !am_sender && tag == 1 && msg_bytes < sizeof data) {
data[msg_bytes] = '\0';
to be send to the server and the server was too old to understand them).
dit(bf(--debug=FLAGS))
-This option lets you have fine-grained control over the
-debug
+This option lets you have fine-grained control over the debug
output you want to see. An individual flag name may be followed by a level
number, with 0 meaning to silence that output, 1 being the default output
level, and higher numbers increasing the output of that flag (for those
verb( rsync -avvv --debug=none src/ dest/
rsync -avA --del --debug=del2,acl src/ dest/ )
+Note that some debug messages will only be output when bf(--msgs2stderr) is
+specified, especially those pertaining to I/O and buffer debugging.
+
This option was added to 3.1.0, so an older rsync on the server side might
reject your attempts at fine-grained control (if one or more flags needed
to be send to the server and the server was too old to understand them).