X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/0f78b81511be65d8fe21af1e6ac674f9e80ac29d..bdac7621eea8aaf7330174f787f68c67215ed026:/io.c diff --git a/io.c b/io.c index c91007eb..e235d3e5 100644 --- a/io.c +++ b/io.c @@ -16,9 +16,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Rsync provides its own multiplexing system, which is used to send @@ -294,6 +294,7 @@ static void read_msg_fd(void) exit_cleanup(RERR_STREAMIO); } close_multiplexing_out(); + defer_forwarding_messages = 0; /* FALL THROUGH */ case MSG_INFO: case MSG_ERROR: @@ -303,7 +304,8 @@ static void read_msg_fd(void) if (n >= sizeof buf) n = sizeof buf - 1; read_loop(fd, buf, n); - if (am_generator && am_server && defer_forwarding_messages) + if (am_generator && am_server + && defer_forwarding_messages && tag != MSG_LOG) msg_list_add(&msg2sndr, tag, buf, n); else rwrite((enum logcode)tag, buf, n); @@ -1134,11 +1136,20 @@ static void msg2sndr_flush(void) while (msg2sndr.head && io_multiplexing_out) { struct msg_list_item *m = msg2sndr.head; + int tag = (IVAL(m->buf, 0) >> 24) - MPLEX_BASE; if (!(msg2sndr.head = m->next)) msg2sndr.tail = NULL; - stats.total_written += m->len; defer_forwarding_messages = 1; - writefd_unbuffered(sock_f_out, m->buf, m->len); + switch (tag) { + case MSG_INFO: + case MSG_ERROR: + rwrite((enum logcode)tag, m->buf + 4, m->len - 4); + break; + default: + stats.total_written += m->len; + writefd_unbuffered(sock_f_out, m->buf, m->len); + break; + } defer_forwarding_messages = 0; free(m); }