[SCM] The rsync repository. - branch master updated
Rsync CVS commit messages
rsync-cvs at lists.samba.org
Sat Nov 9 11:52:06 MST 2013
The branch, master has been updated
via 18217a9 Fix timeout checking in safe_read().
via 090ef59 Change safe_read() to select() before reading.
from 708db6f Git rid of uneeded extern.
;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 18217a94c488b29aa8048d8626461cf82fd4ebae
Author: Wayne Davison <wayned at samba.org>
Date: Sat Nov 9 10:49:59 2013 -0800
Fix timeout checking in safe_read().
commit 090ef59b29403fbe77a7a3aa2042efd8a628c673
Author: Wayne Davison <wayned at samba.org>
Date: Sat Nov 9 10:32:44 2013 -0800
Change safe_read() to select() before reading.
-----------------------------------------------------------------------
Summary of changes:
io.c | 35 +++++++++--------------------------
1 files changed, 9 insertions(+), 26 deletions(-)
Changeset truncated at 500 lines:
diff --git a/io.c b/io.c
index 3036903..2a87919 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)
@@ -232,28 +232,10 @@ static NORETURN void whine_about_eof(BOOL allow_kluge)
* the socket except very early in the transfer. */
static size_t safe_read(int fd, char *buf, size_t len)
{
- size_t got;
- int n;
+ size_t got = 0;
assert(fd != iobuf.in_fd);
- n = read(fd, buf, len);
- if ((size_t)n == len || n == 0) {
- if (DEBUG_GTE(IO, 2))
- rprintf(FINFO, "[%s] safe_read(%d)=%ld\n", who_am_i(), fd, (long)n);
- return n;
- }
- if (n < 0) {
- if (errno != EINTR && errno != EWOULDBLOCK && errno != EAGAIN) {
- read_failed:
- rsyserr(FERROR, errno, "safe_read failed to read %ld bytes [%s]",
- (long)len, who_am_i());
- exit_cleanup(RERR_STREAMIO);
- }
- got = 0;
- } else
- got = n;
-
while (1) {
struct timeval tv;
fd_set r_fds, e_fds;
@@ -273,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;
}
@@ -282,7 +263,7 @@ static size_t safe_read(int fd, char *buf, size_t len)
rprintf(FINFO, "select exception on fd %d\n", fd); */
if (FD_ISSET(fd, &r_fds)) {
- n = read(fd, buf + got, len - got);
+ int n = read(fd, buf + got, len - got);
if (DEBUG_GTE(IO, 2))
rprintf(FINFO, "[%s] safe_read(%d)=%ld\n", who_am_i(), fd, (long)n);
if (n == 0)
@@ -290,7 +271,9 @@ static size_t safe_read(int fd, char *buf, size_t len)
if (n < 0) {
if (errno == EINTR)
continue;
- goto read_failed;
+ rsyserr(FERROR, errno, "safe_read failed to read %ld bytes [%s]",
+ (long)len, who_am_i());
+ exit_cleanup(RERR_STREAMIO);
}
if ((got += (size_t)n) == len)
break;
@@ -768,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);
}
--
The rsync repository.
More information about the rsync-cvs
mailing list