diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2000-04-16 16:59:39 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2000-04-16 16:59:39 +0000 |
commit | a6d253d4e37650dee64192247f24d7ddb68888b7 (patch) | |
tree | 432707f2d6c9ec82808aa99a723495708970a476 /network_io/win32 | |
parent | 5fe3c759a295e20e1dfd3cddcec90f8f1e082307 (diff) | |
download | libapr-a6d253d4e37650dee64192247f24d7ddb68888b7.tar.gz |
APR_SO_TIMEOUT now takes microseconds instead of seconds. (The new
CHANGES text also reflects prior work on ap_poll() and
ap_set_pipe_timeout()).
apr/test/client.c now has a crude command-line mechanism for selecting
a read timeout.
Included bug fixes:
1) Some storage leaks were removed in BeOS and Unix select() usage.
2) For Win32, the code to process APR_SO_TIMEOUT stored timeout in
milliseconds but the code to timeout a TransmitFile() in
ap_sendfile() assumed that it had been stored in seconds.
3) ab_apr.c used a 30,000-second timeout in one place. This was
changed to a 30-second timeout.
4) fix bad perldoc comment in apr_network_io.h which hid the
ap_shutdown() prototype
5) disable stdout buffering in apr/test/client.c so that messages
appear in the correct order when an error occurs
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59870 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io/win32')
-rw-r--r-- | network_io/win32/networkio.h | 2 | ||||
-rw-r--r-- | network_io/win32/sendrecv.c | 6 | ||||
-rw-r--r-- | network_io/win32/sockopt.c | 5 |
3 files changed, 8 insertions, 5 deletions
diff --git a/network_io/win32/networkio.h b/network_io/win32/networkio.h index 5421312e2..58d82f8b1 100644 --- a/network_io/win32/networkio.h +++ b/network_io/win32/networkio.h @@ -64,7 +64,7 @@ struct ap_socket_t { struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; size_t addr_len; - int timeout; + ap_interval_time_t timeout; }; struct ap_pollfd_t { diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index 409c200ec..33d39fb07 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -239,9 +239,11 @@ ap_status_t ap_sendfile(ap_socket_t * sock, ap_file_t * file, lasterror = WSAGetLastError(); if (lasterror == ERROR_IO_PENDING) { #ifdef WAIT_FOR_EVENT - rv = WaitForSingleObject(overlapped.hEvent, sock->timeout * 1000); + rv = WaitForSingleObject(overlapped.hEvent, + sock->timeout >= 0 ? sock->timeout / 1000 : INFINITE); #else - rv = WaitForSingleObject((HANDLE) sock->sock, sock->timeout * 1000); + rv = WaitForSingleObject((HANDLE) sock->sock, + sock->timeout >= 0 ? sock->timeout / 1000 : 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 d45e7b82e..d269b64e6 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -91,8 +91,9 @@ ap_status_t ap_setsocketopt(ap_socket_t *sock, ap_int32_t opt, ap_int32_t on) one = 0; if (opt & APR_SO_TIMEOUT) { - int timeout = on * 1000; /* Windows needs timeout in mSeconds */ - sock->timeout = timeout; + int timeout; + sock->timeout = on; + timeout = on / 1000; /* Windows needs timeout in mSeconds */ if (setsockopt(sock->sock, SOL_SOCKET, SO_RCVTIMEO, (char*) &timeout, sizeof(timeout)) == SOCKET_ERROR) { return WSAGetLastError(); |