From: Wayne Davison Date: Sat, 9 Nov 2013 18:49:59 +0000 (-0800) Subject: Fix timeout checking in safe_read(). X-Git-Tag: v3.1.1pre1~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18217a94c488b29aa8048d8626461cf82fd4ebae;p=thirdparty%2Frsync.git Fix timeout checking in safe_read(). --- diff --git a/io.c b/io.c index 28f5fe8d..2a87919f 100644 --- a/io.c +++ b/io.c @@ -155,7 +155,7 @@ static void read_a_msg(void); static void drain_multiplex_messages(void); static void sleep_for_bwlimit(int bytes_written); -static void check_timeout(BOOL allow_keepalive) +static void check_timeout(BOOL allow_keepalive, int keepalive_flags) { time_t t, chk; @@ -177,7 +177,7 @@ static void check_timeout(BOOL allow_keepalive) if (allow_keepalive) { /* This may put data into iobuf.msg w/o flushing. */ - maybe_send_keepalive(t, 0); + maybe_send_keepalive(t, keepalive_flags); } if (!last_io_in) @@ -255,8 +255,7 @@ static size_t safe_read(int fd, char *buf, size_t len) who_am_i()); exit_cleanup(RERR_FILEIO); } - if (io_timeout) - maybe_send_keepalive(time(NULL), MSK_ALLOW_FLUSH); + check_timeout(1, MSK_ALLOW_FLUSH); continue; } @@ -752,7 +751,7 @@ static char *perform_io(size_t needed, int flags) send_extra_file_list(sock_f_out, -1); extra_flist_sending_enabled = !flist_eof; } else - check_timeout((flags & PIO_NEED_INPUT) != 0); + check_timeout((flags & PIO_NEED_INPUT) != 0, 0); FD_ZERO(&r_fds); /* Just in case... */ FD_ZERO(&w_fds); }