aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-06-06 19:02:09 +0000
committerWayne Davison <wayned@samba.org>2004-06-06 19:02:09 +0000
commite626b29e1024348054863a9f92355a32dfec6b13 (patch)
tree27df78302937080eba8a36880759ac81f6a84115 /io.c
parentf89b936801420f84f0639d718149106a622befc0 (diff)
downloadandroid_external_rsync-e626b29e1024348054863a9f92355a32dfec6b13.tar.gz
android_external_rsync-e626b29e1024348054863a9f92355a32dfec6b13.tar.bz2
android_external_rsync-e626b29e1024348054863a9f92355a32dfec6b13.zip
Make sure our select calls don't sleep for over one minute at a time,
even when io_timeout is a longer value (though the code in options.c might set it to a shorter value if io_timeout is small).
Diffstat (limited to 'io.c')
-rw-r--r--io.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/io.c b/io.c
index 2e9b5407..c14f7ad8 100644
--- a/io.c
+++ b/io.c
@@ -53,10 +53,12 @@ extern int io_timeout;
extern int am_server;
extern int am_daemon;
extern int am_sender;
+extern int eol_nulls;
+extern char *remote_filesfrom_file;
extern struct stats stats;
-
const char phase_unknown[] = "unknown";
+int select_timeout = SELECT_TIMEOUT;
/**
* The connection might be dropped at some point; perhaps because the
@@ -267,7 +269,7 @@ int msg_list_push(int flush_it_all)
return 0;
FD_ZERO(&fds);
FD_SET(msg_fd_out, &fds);
- tv.tv_sec = io_timeout ? io_timeout : SELECT_TIMEOUT;
+ tv.tv_sec = select_timeout;
tv.tv_usec = 0;
if (!select(msg_fd_out+1, NULL, &fds, NULL, &tv))
check_timeout();
@@ -404,7 +406,7 @@ static int read_timeout(int fd, char *buf, size_t len)
fd_count = new_fd+1;
}
- tv.tv_sec = io_timeout?io_timeout:SELECT_TIMEOUT;
+ tv.tv_sec = select_timeout;
tv.tv_usec = 0;
errno = 0;
@@ -455,7 +457,6 @@ static int read_timeout(int fd, char *buf, size_t len)
io_filesfrom_buflen = io_filesfrom_lastchar? 2 : 1;
io_filesfrom_f_in = -1;
} else {
- extern int eol_nulls;
if (!eol_nulls) {
char *s = io_filesfrom_buf + l;
/* Transform CR and/or LF into '\0' */
@@ -525,9 +526,6 @@ int read_filesfrom_line(int fd, char *fname)
{
char ch, *s, *eob = fname + MAXPATHLEN - 1;
int cnt;
- extern int io_timeout;
- extern int eol_nulls;
- extern char *remote_filesfrom_file;
int reading_remotely = remote_filesfrom_file != NULL;
int nulls = eol_nulls || reading_remotely;
@@ -541,7 +539,7 @@ int read_filesfrom_line(int fd, char *fname)
fd_set fds;
FD_ZERO(&fds);
FD_SET(fd, &fds);
- tv.tv_sec = io_timeout? io_timeout : SELECT_TIMEOUT;
+ tv.tv_sec = select_timeout;
tv.tv_usec = 0;
if (!select(fd+1, &fds, NULL, NULL, &tv))
check_timeout();
@@ -819,7 +817,7 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
fd_count = msg_fd_in;
}
- tv.tv_sec = io_timeout?io_timeout:SELECT_TIMEOUT;
+ tv.tv_sec = select_timeout;
tv.tv_usec = 0;
errno = 0;