You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/06/22 19:42:42 UTC
cvs commit: apache-2.0/src/os/unix iol_socket.c
trawick 00/06/22 10:42:42
Modified: src/lib/apr/network_io/unix sockopt.c
src/os/unix iol_socket.c
Log:
Implement retrieval of socket timeouts for Unix so that saferead() can
restore the original timeout on exit.
This is very similar to the Win32 implementation Bill Stoddard a week ago.
Revision Changes Path
1.29 +12 -0 apache-2.0/src/lib/apr/network_io/unix/sockopt.c
Index: sockopt.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockopt.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- sockopt.c 2000/06/17 11:32:38 1.28
+++ sockopt.c 2000/06/22 17:42:29 1.29
@@ -172,6 +172,18 @@
return APR_SUCCESS;
}
+ap_status_t ap_getsocketopt(ap_socket_t *sock, ap_int32_t opt, ap_int32_t *on)
+{
+ switch(opt) {
+ case APR_SO_TIMEOUT:
+ *on = sock->timeout;
+ break;
+ default:
+ return APR_EINVAL;
+ }
+ return APR_SUCCESS;
+}
+
ap_status_t ap_gethostname(char *buf, ap_int32_t len, ap_pool_t *cont)
{
if (gethostname(buf, len) == -1)
1.25 +6 -3 apache-2.0/src/os/unix/iol_socket.c
Index: iol_socket.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/os/unix/iol_socket.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- iol_socket.c 2000/06/12 23:03:02 1.24
+++ iol_socket.c 2000/06/22 17:42:34 1.25
@@ -92,12 +92,15 @@
static ap_status_t unix_getopt(ap_iol *viol, ap_iol_option opt, void *value)
{
+ iol_socket *iol = (iol_socket *)viol;
+
switch (opt) {
case AP_IOL_TIMEOUT:
- /* no-op */
- break;
+ ap_getsocketopt(iol->sock, APR_SO_TIMEOUT, (ap_int32_t *) value);
+ (*(ap_int32_t *)value) /= AP_USEC_PER_SEC;
+ break;
default:
- return APR_EINVAL;
+ return APR_EINVAL;
}
return APR_SUCCESS;
}