rbb 99/02/24 12:30:20
Modified:pthreads/src/include http_main.h httpd.h
pthreads/src/main buff.c http_core.c http_main.c
http_protocol.c
Log:
Implemented timeouts in the hybrid server. We are using non_blocking I/O
and and poll to implement the timeouts. I will probably just implement
recvwithtimeout on all systems, but this change lets us do some testing. The
overall logic won't change with any subsequent change, just where the
waiting is done. In order to use poll, we have to have our timeouts in
milliseconds, so I convert from sec -> millisec when the user specifies a
timeout in the config file. Lastly, I set the default timeout to 2 min.
instead
of five. May not be a good idea, but it helps me test easier. We can set it
higher later if we have to.
Revision ChangesPath
1.4 +1 -0 apache-apr/pthreads/src/include/http_main.h
Index: http_main.h
===
RCS file: /home/cvs/apache-apr/pthreads/src/include/http_main.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- http_main.h 1999/02/09 21:39:52 1.3
+++ http_main.h 1999/02/24 20:30:14 1.4
@@ -115,6 +115,7 @@
void ap_start_shutdown(void);
void ap_start_restart(int);
void ap_keepalive_timeout(char *, request_rec *);
+int ap_get_timeout(request_rec *r);
API_EXPORT(void) ap_child_terminate(request_rec *r);
int ap_update_child_status(int child_num, int thread_num, int status,
request_rec *r);
1.9 +2 -2 apache-apr/pthreads/src/include/httpd.h
Index: httpd.h
===
RCS file: /home/cvs/apache-apr/pthreads/src/include/httpd.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- httpd.h 1999/02/16 16:00:47 1.8
+++ httpd.h 1999/02/24 20:30:14 1.9
@@ -258,12 +258,12 @@
/* The timeout for waiting for messages */
#ifndef DEFAULT_TIMEOUT
-#define DEFAULT_TIMEOUT 300
+#define DEFAULT_TIMEOUT 12
#endif
/* The timeout for waiting for keepalive timeout until next request */
#ifndef DEFAULT_KEEPALIVE_TIMEOUT
-#define DEFAULT_KEEPALIVE_TIMEOUT 15
+#define DEFAULT_KEEPALIVE_TIMEOUT 15000
#endif
/* The number of requests to entertain per connection */
1.3 +31 -5 apache-apr/pthreads/src/main/buff.c
Index: buff.c
===
RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- buff.c1999/02/07 06:29:30 1.2
+++ buff.c1999/02/24 20:30:16 1.3
@@ -539,18 +539,44 @@
return value;
}
-
API_EXPORT(int) ap_bnonblock(BUFF *fb, int direction)
{
APRFile fd;
+int fd_flags;
+
+fd = (direction == B_RD) ? fb->fd_in : fb->fd;
+fd_flags = fcntl(fd, F_GETFL, 0);
+#if defined(O_NONBLOCK)
+fd_flags |= O_NONBLOCK;
+return fcntl(fd, F_SETFL, fd_flags);
+#elif defined(O_NDELAY)
+fd_flags |= O_NDELAY;
+return fcntl(fd, F_SETFL, fd_flags);
+#eli f defined(FNDELAY)
+fd_flags |= O_FNDELAY;
+return fcntl(fd, F_SETFL, fd_flags);
+#else
+/* : this breaks things, but an alternative isn't obvious...*/
+return 0;
+#endif
+}
+
+API_EXPORT(int) ap_bblock(BUFF *fb, int direction)
+{
+APRFile fd;
+int fd_flags;
fd = (direction == B_RD) ? fb->fd_in : fb->fd;
+fd_flags = fcntl(fd, F_GETFL, 0);
#if defined(O_NONBLOCK)
-return fcntl(fd, F_SETFL, O_NONBLOCK);
+fd_flags &= ~O_NONBLOCK;
+return fcntl(fd, F_SETFL, fd_flags);
#elif defined(O_NDELAY)
-return fcntl(fd, F_SETFL, O_NDELAY);
-#elif defined(FNDELAY)
-return fcntl(fd, F_SETFL, FNDELAY);
+fd_flags &= ~O_NDELAY;
+return fcntl(fd, F_SETFL, fd_flags);
+#eli f defined(FNDELAY)
+fd_flags &= ~O_FNDELAY;
+return fcntl(fd, F_SETFL, fd_flags);
#else
/* : this breaks things, but an alternative isn't obvious...*/
return 0;
1.8 +2 -2 apache-apr/pthreads/src/main/http_core.c
Index: http_core.c
===
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_core.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- http_core.c 1999/02/23 19:11:21 1.7
+++ http_core.c 1999/02/24 20:30:17 1.8
@@ -1965,7 +1965,7 @@
return err;
}
-cmd->server->timeout = atoi(arg);
+cmd->server->timeout = atoi(arg) * 1000;
return NULL;
}
@@ -1977,7 +1977,7 @@
return err;
}
-cmd->server->keep_alive_timeout = atoi(arg);
+cmd->server->keep_ali