From 33c9bb9e35bcf4adad90ec9dffdb5da71e893954 Mon Sep 17 00:00:00 2001 From: Hamid Aghdaee Date: Tue, 4 Feb 2003 22:15:30 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=864 --- client/client_state.C | 2 +- client/main.C | 2 +- client/net_xfer.C | 15 +++++++++------ client/net_xfer.h | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/client/client_state.C b/client/client_state.C index 23aca41ad1..029e02f88e 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -68,7 +68,7 @@ CLIENT_STATE::CLIENT_STATE() { platform_name = HOST; exit_after = -1; app_started = 0; - max_transfer_rate = 9999999; + max_transfer_rate = 9999; max_bytes = 0; user_idle = true; use_http_proxy = false; diff --git a/client/main.C b/client/main.C index 145f9990b1..ac1e799a88 100644 --- a/client/main.C +++ b/client/main.C @@ -88,7 +88,7 @@ int main(int argc, char** argv) { if (!gstate.do_something()) { if (log_flags.time_debug) printf("SLEEP 1 SECOND\n"); fflush(stdout); - boinc_sleep(1); + // boinc_sleep(.01); } if (gstate.time_to_exit()) { diff --git a/client/net_xfer.C b/client/net_xfer.C index 3a07b02fe0..6b8016fd63 100644 --- a/client/net_xfer.C +++ b/client/net_xfer.C @@ -197,11 +197,14 @@ int NET_XFER_SET::remove(NET_XFER* nxp) { // int NET_XFER_SET::poll(int max_bytes, int& bytes_transferred) { int n, retval; + struct timeval timeout; bytes_transferred = 0; while (1) { - retval = do_select(max_bytes, n); - if (retval) return retval; + timeout.tv_usec = 0; + timeout.tv_sec = 1; + retval = do_select(max_bytes, n, timeout); + if (retval) return retval; if (n == 0) break; max_bytes -= n; bytes_transferred += n; @@ -212,8 +215,8 @@ int NET_XFER_SET::poll(int max_bytes, int& bytes_transferred) { // do a select and do I/O on as many sockets as possible. // -int NET_XFER_SET::do_select(int max_bytes, int& bytes_transferred) { - struct timeval zeros; +int NET_XFER_SET::do_select(int max_bytes, int& bytes_transferred, struct timeval timeout) { + int n, fd, retval; socklen_t i; NET_XFER *nxp; @@ -229,7 +232,7 @@ int NET_XFER_SET::do_select(int max_bytes, int& bytes_transferred) { bytes_transferred = 0; fd_set read_fds, write_fds, error_fds; - memset(&zeros, 0, sizeof(zeros)); + FD_ZERO(&read_fds); FD_ZERO(&write_fds); @@ -248,7 +251,7 @@ int NET_XFER_SET::do_select(int max_bytes, int& bytes_transferred) { } FD_SET(net_xfers[i]->socket, &error_fds); } - n = select(FD_SETSIZE, &read_fds, &write_fds, &error_fds, &zeros); + n = select(FD_SETSIZE, &read_fds, &write_fds, &error_fds, &timeout); if (log_flags.net_xfer_debug) printf("select returned %d\n", n); if (n == 0) return 0; if (n < 0) return ERR_SELECT; diff --git a/client/net_xfer.h b/client/net_xfer.h index 21e0be84af..d724625f70 100644 --- a/client/net_xfer.h +++ b/client/net_xfer.h @@ -63,7 +63,7 @@ public: int insert(NET_XFER*); int remove(NET_XFER*); int poll(int max_bytes, int& bytes_transferred); - int do_select(int max_bytes, int& bytes_transferred); + int do_select(int max_bytes, int& bytes_transferred, struct timeval timeout); NET_XFER* lookup_fd(int); // lookup by fd };