if the io_flush() call happened to read the last message from the
receiver, causing the read_msg_fd() call to deadlock.
- Fixed an error-looping problem when the server-side receiver failed
to send a message down the error-msg pipe: we no longer try to send
a new error about this new failure down the same failing pipe.
- Make sure that we stop any deferring of forwarded messages in the
generator when we are exiting with an error.
void wait_for_receiver(void)
{
void wait_for_receiver(void)
{
- io_flush(NORMAL_FLUSH);
- read_msg_fd();
+ if (iobuf_out_cnt)
+ io_flush(NORMAL_FLUSH);
+ else
+ read_msg_fd();
count = select(maxfd + 1, &r_fds, &w_fds, NULL, &tv);
if (count <= 0) {
count = select(maxfd + 1, &r_fds, &w_fds, NULL, &tv);
if (count <= 0) {
+ if (errno == EBADF) {
+ defer_forwarding_messages = 0;
exit_cleanup(RERR_SOCKETIO);
exit_cleanup(RERR_SOCKETIO);
check_timeout();
continue;
}
check_timeout();
continue;
}
/* Don't try to write errors back across the stream. */
if (fd == sock_f_out)
io_end_multiplex_out();
/* Don't try to write errors back across the stream. */
if (fd == sock_f_out)
io_end_multiplex_out();
+ /* Don't try to write errors down a failing msg pipe. */
+ if (am_server && fd == msg_fd_out)
+ exit_cleanup(RERR_STREAMIO);
rsyserr(FERROR, errno,
"writefd_unbuffered failed to write %ld bytes [%s]",
(long)len, who_am_i());
rsyserr(FERROR, errno,
"writefd_unbuffered failed to write %ld bytes [%s]",
(long)len, who_am_i());