]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Fix timeout checking in safe_read().
authorWayne Davison <wayned@samba.org>
Sat, 9 Nov 2013 18:49:59 +0000 (10:49 -0800)
committerWayne Davison <wayned@samba.org>
Sat, 9 Nov 2013 18:49:59 +0000 (10:49 -0800)
io.c

diff --git a/io.c b/io.c
index 28f5fe8d96444b7f6333394f2f04d431789ae3d7..2a87919fe8962aa1263ed87521788832d476ab94 100644 (file)
--- 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);
                }