Attached is the patch to eliminate the new timeout_ms field that
Ryan objected to this morning.
I have no intention of committing it. I do not agree with the sentiment
that it is difficult to track multi-option/multi-value settings when everyone
is using the accessor [e.g. apr_socket_timeout_set().]
Be that what it is; here's the patch, I won't veto it.
Bill
Index: include/arch/win32/networkio.h
===================================================================
RCS file: /home/cvs/apr/include/arch/win32/networkio.h,v
retrieving revision 1.28
diff -u -r1.28 networkio.h
--- include/arch/win32/networkio.h 15 Jul 2002 07:26:12 -0000 1.28
+++ include/arch/win32/networkio.h 15 Jul 2002 20:36:04 -0000
@@ -64,7 +64,6 @@
int type; /* SOCK_STREAM, SOCK_DGRAM */
apr_sockaddr_t *local_addr;
apr_sockaddr_t *remote_addr;
- int timeout_ms; /* MUST MATCH if timeout > 0 */
apr_interval_time_t timeout;
apr_int32_t disconnected;
int local_port_unknown;
Index: network_io/win32/sendrecv.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sendrecv.c,v
retrieving revision 1.56
diff -u -r1.56 sendrecv.c
--- network_io/win32/sendrecv.c 15 Jul 2002 07:26:12 -0000 1.56
+++ network_io/win32/sendrecv.c 15 Jul 2002 20:36:04 -0000
@@ -355,8 +355,9 @@
if ((status == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) ||
(status == APR_FROM_OS_ERROR(WSA_IO_PENDING))) {
rv = WaitForSingleObject(wait_event,
- (DWORD)(sock->timeout >= 0
- ? sock->timeout_ms :
INFINITE));
+ (sock->timeout >= 0
+ ? (DWORD)apr_time_as_msec(sock->timeout)
+ : INFINITE));
if (rv == WAIT_OBJECT_0) {
status = APR_SUCCESS;
if (!disconnected) {
Index: network_io/win32/sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sockopt.c,v
retrieving revision 1.45
diff -u -r1.45 sockopt.c
--- network_io/win32/sockopt.c 15 Jul 2002 20:29:38 -0000 1.45
+++ network_io/win32/sockopt.c 15 Jul 2002 20:36:04 -0000
@@ -99,14 +99,12 @@
/* Reset socket timeouts if the new timeout differs from the old
timeout */
if (sock->timeout != t)
{
- /* Win32 timeouts are in msec, represented as int */
- sock->timeout_ms = (int)apr_time_as_msec(t);
+ /* Win32 SO_XXXTIMEO values are in msec, represented as int */
+ int ms = (int)apr_time_as_msec(t);
setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO,
- (char *) &sock->timeout_ms,
- sizeof(sock->timeout_ms));
+ (char *) &ms, sizeof(ms));
setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO,
- (char *) &sock->timeout_ms,
- sizeof(sock->timeout_ms));
+ (char *) &ms, sizeof(ms));
}
}
else if (t < 0) {