Hi,
I have a fix for non-blocking apr_connect() on Windows.
Though sock->timeout is millisecond, it is treated as microsecond.
Please see the attached patch.
The credit goes to TANAKA Koichi <[EMAIL PROTECTED]>, who found and fixed it.
Thanks.
- INOUE Seiichiro <[EMAIL PROTECTED]>
http://www.ariel-networks.com
Index: network_io/win32/sockets.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/win32/sockets.c,v
retrieving revision 1.80
diff -u -r1.80 sockets.c
--- network_io/win32/sockets.c 5 Jul 2002 17:58:10 -0000 1.80
+++ network_io/win32/sockets.c 10 Jul 2002 09:25:13 -0000
@@ -60,6 +60,9 @@
#include <string.h>
#include "inherit.h"
+/** number of milliseconds per second */
+#define APR_MSEC_PER_SEC APR_TIME_C(1000)
+
static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */
static apr_status_t socket_cleanup(void *sock)
@@ -315,8 +318,8 @@
tvptr = NULL;
}
else {
- tv.tv_sec = (long)(sock->timeout / APR_USEC_PER_SEC);
- tv.tv_usec = (long)(sock->timeout % APR_USEC_PER_SEC);
+ tv.tv_sec = (long)(sock->timeout / APR_MSEC_PER_SEC);
+ tv.tv_usec = (long)(sock->timeout % APR_MSEC_PER_SEC);
tvptr = &tv;
}
rc = select(FD_SETSIZE+1, NULL, &wfdset, &efdset, tvptr);