diff options
author | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-04 02:42:32 +0000 |
---|---|---|
committer | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-04 02:42:32 +0000 |
commit | 89c13dc4950a643339cfbd1fa9768cfe159f3e63 (patch) | |
tree | b7ce296076fdb2c109b14f2114df49623bb3dd46 | |
parent | 09e889db6fae6a790d138b303d7fda8b6fdf1d51 (diff) | |
download | libapr-89c13dc4950a643339cfbd1fa9768cfe159f3e63.tar.gz |
Win32: Fix problem with timeout units on TransmitFile.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60473 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | network_io/win32/sendrecv.c | 4 | ||||
-rw-r--r-- | network_io/win32/sockopt.c | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index f26c724c1..eedb0de8a 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -239,10 +239,10 @@ apr_status_t ap_sendfile(apr_socket_t * sock, apr_file_t * file, if (lasterror == ERROR_IO_PENDING) { #ifdef WAIT_FOR_EVENT rv = WaitForSingleObject(overlapped.hEvent, - sock->timeout >= 0 ? sock->timeout / 1000 : INFINITE); + sock->timeout >= 0 ? sock->timeout : INFINITE); #else rv = WaitForSingleObject((HANDLE) sock->sock, - sock->timeout >= 0 ? sock->timeout / 1000 : INFINITE); + sock->timeout >= 0 ? sock->timeout : INFINITE); #endif if (rv == WAIT_OBJECT_0) lasterror = APR_SUCCESS; diff --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c index 2114ce928..99d7fd093 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -92,8 +92,10 @@ apr_status_t apr_setsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t o if (on <= 0) new_timeout = on; else - new_timeout = on/1000; /* Windows needs timeout in mSeconds */ - + /* Convert from APR units (microseconds) to windows units + * (milliseconds) */ + new_timeout = on/1000; + if (new_timeout == 0) { /* Set the socket non-blocking if it was previously blocking */ if (sock->timeout != 0) { @@ -170,9 +172,9 @@ apr_status_t apr_getsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t * { switch (opt) { case APR_SO_TIMEOUT: - /* Do we want to store sock->timeout in APR units or windows units? */ - *on = sock->timeout * 1000; /* Convert from milliseconds (windows units) to microseconds - * (APR units) */ + /* Convert from milliseconds (windows units) to microseconds + * (APR units) */ + *on = sock->timeout * 1000; break; case APR_SO_DISCONNECTED: *on = sock->disconnected; |