Use simpler multiplexed-out stopping method.
Make sure we can't false-match a socket fd.
if (n <= 0) {
if (n == 0)
whine_about_eof(fd); /* Doesn't return. */
if (n <= 0) {
if (n == 0)
whine_about_eof(fd); /* Doesn't return. */
- if (errno == EINTR || errno == EWOULDBLOCK
- || errno == EAGAIN)
+ if (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN)
continue;
/* Don't write errors on a dead socket. */
if (fd == sock_f_in) {
continue;
/* Don't write errors on a dead socket. */
if (fd == sock_f_in) {
- io_end_multiplex_out();
+ if (am_sender)
+ io_multiplexing_out = 0;
rsyserr(FERROR_SOCKET, errno, "read error");
} else
rsyserr(FERROR, errno, "read error");
rsyserr(FERROR_SOCKET, errno, "read error");
} else
rsyserr(FERROR, errno, "read error");
if (!am_generator)
goto invalid_msg;
if (tag == MSG_ERROR_SOCKET)
if (!am_generator)
goto invalid_msg;
if (tag == MSG_ERROR_SOCKET)
- io_end_multiplex_out();
+ io_multiplexing_out = 0;
/* FALL THROUGH */
case MSG_INFO:
case MSG_ERROR:
/* FALL THROUGH */
case MSG_INFO:
case MSG_ERROR:
/* Don't try to write errors back across the stream. */
if (fd == sock_f_out)
/* Don't try to write errors back across the stream. */
if (fd == sock_f_out)
- io_end_multiplex_out();
+ io_multiplexing_out = 0;
/* Don't try to write errors down a failing msg pipe. */
if (am_server && fd == msg_fd_out)
exit_cleanup(RERR_STREAMIO);
/* Don't try to write errors down a failing msg pipe. */
if (am_server && fd == msg_fd_out)
exit_cleanup(RERR_STREAMIO);
extern int read_batch;
extern int write_batch;
extern int batch_fd;
extern int read_batch;
extern int write_batch;
extern int batch_fd;
+extern int sock_f_in;
+extern int sock_f_out;
extern int filesfrom_fd;
extern int connect_timeout;
extern pid_t cleanup_child_pid;
extern int filesfrom_fd;
extern int connect_timeout;
extern pid_t cleanup_child_pid;
close(error_pipe[0]);
if (f_in != f_out)
close(f_out);
close(error_pipe[0]);
if (f_in != f_out)
close(f_out);
/* we can't let two processes write to the socket at one time */
io_end_multiplex_out();
/* we can't let two processes write to the socket at one time */
io_end_multiplex_out();
close(error_pipe[1]);
if (f_in != f_out)
close(f_in);
close(error_pipe[1]);
if (f_in != f_out)
close(f_in);
io_start_buffering_out(f_out);
io_start_buffering_out(f_out);