diff -C 5 -r rsync-2.6.0/io.c rsync-2.6.0-patched/io.c *** rsync-2.6.0/io.c Fri Dec 26 17:04:01 2003 --- rsync-2.6.0-patched/io.c Sat Nov 26 13:13:06 2005 *************** *** 34,45 **** * io_start_multiplex_out() and io_start_multiplex_in(). **/ #include "rsync.h" ! /** If no timeout is specified then use a 60 second select timeout */ ! #define SELECT_TIMEOUT 60 static int io_multiplexing_out; static int io_multiplexing_in; static int multiplex_in_fd; static int multiplex_out_fd; --- 34,45 ---- * io_start_multiplex_out() and io_start_multiplex_in(). **/ #include "rsync.h" ! /** If no timeout is specified then use a 5 second select timeout */ ! #define SELECT_TIMEOUT 5 static int io_multiplexing_out; static int io_multiplexing_in; static int multiplex_in_fd; static int multiplex_out_fd; *************** *** 631,641 **** if (count <= 0) { if (errno == EBADF) { exit_cleanup(RERR_SOCKETIO); } ! continue; } if (io_error_fd != -1 && FD_ISSET(io_error_fd, &r_fds)) { read_error_fd(); } --- 631,654 ---- if (count <= 0) { if (errno == EBADF) { exit_cleanup(RERR_SOCKETIO); } ! /* check for a dead socket */ ! if (is_a_socket(fd) && io_timeout <= 0) ! { ! char buffer[32]; ! if (recv(fd, buffer, sizeof buffer, MSG_PEEK) <= 0) ! { ! /* The socket may be closed. The only way to know for sure ! * is to try writing. If it is closed, write() will return ! * -1 with errno == EPIPE. If it is not closed, this process ! * will block until the transfer resumes or until the ! * kernel reaps the socket because of timeout. */ ! FD_SET(fd, &w_fds); ! } else continue; ! } else continue; } if (io_error_fd != -1 && FD_ISSET(io_error_fd, &r_fds)) { read_error_fd(); }