manoj 99/04/14 14:38:30
Modified: pthreads/src/include http_accept.h
pthreads/src/main http_accept.c http_main.c
Log:
Some tweaking of our http_accept modularization. A call is added to
perform any initialization needed in the parent. With this, we can take
all knowledge about accept serialization out of http_main.c. Also, the
function names were changed as a result of this addition and to keep the
difference between "request" and "connection" straight.
accept_parent_init (NEW)
init_accept -> accept_child_init
start_accepting_requests -> start_accepting_connections
get_request -> get_connection
stop_accepting_requests -> stop_accepting_connections
Revision Changes Path
1.3 +5 -13 apache-apr/pthreads/src/include/http_accept.h
Index: http_accept.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- http_accept.h 1999/04/14 21:03:18 1.2
+++ http_accept.h 1999/04/14 21:38:28 1.3
@@ -79,19 +79,11 @@
#define USE_ACCEPT_QUEUE
/*#define USE_MULTI_ACCEPT*/
-#if defined (USE_ACCEPT_QUEUE)
-void init_accept(pool*, int, int);
-void start_accepting_requests(int);
-int get_request(struct sockaddr *);
-void stop_accepting_requests(pool*);
-
-#elif defined (USE_MULTI_ACCEPT)
-void init_accept(pool*,int, int);
-void start_accepting_requests(int);
-int get_request(struct sockaddr *);
-void stop_accepting_requests(pool *);
-#endif
-
+void accept_parent_init(pool*);
+void accept_child_init(pool*, int, int);
+void start_accepting_connections(int);
+int get_connection(struct sockaddr *);
+void stop_accepting_connections(pool*);
#ifdef __cplusplus
}
1.5 +17 -8 apache-apr/pthreads/src/main/http_accept.c
Index: http_accept.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- http_accept.c 1999/04/14 21:03:26 1.4
+++ http_accept.c 1999/04/14 21:38:28 1.5
@@ -181,6 +181,11 @@
}
}
+void accept_parent_init(pool *pconf)
+{
+ SAFE_ACCEPT(accept_mutex_init(pconf));
+}
+
/*
* Description:
* Do any setup or initialization required before worker threads begin
@@ -191,7 +196,7 @@
* 3. Pass in server_conf?
* 4. Simply access the globals (yech...)
*/
-void init_accept(pool* pchild,
+void accept_child_init(pool* pchild,
int worker_threads_per_child,
int acceptor_threads_per_child)
{
@@ -202,7 +207,7 @@
}
-void start_accepting_requests(int my_child_num)
+void start_accepting_connections(int my_child_num)
{
proc_info *my_info;
pthread_t thread;
@@ -275,7 +280,7 @@
accept_thread(my_info);
}
-int get_request(struct sockaddr *sa_client)
+int get_connection(struct sockaddr *sa_client)
{
int csd = -1;
int block_if_empty = 1;
@@ -295,7 +300,7 @@
return csd;
}
-void stop_accepting_requests(pool* pconf)
+void stop_accepting_connections(pool* pconf)
{
requests_this_child = 0;
/* The two functions to get all of our other threads to die off. */
@@ -313,8 +318,12 @@
static int num_listenfds;
static struct pollfd *listenfds;
+void accept_parent_init(pool *pconf)
+{
+ SAFE_ACCEPT(accept_mutex_init(pconf));
+}
-void init_accept(pool* pchild,
+void accept_child_init(pool* pchild,
int worker_threads_per_child,
int acceptors_per_child)
{
@@ -336,10 +345,10 @@
}
}
-void start_accepting_requests(int my_child_num)
+void start_accepting_connections(int my_child_num)
{
}
-int get_request(struct sockaddr *sa_client)
+int get_connection(struct sockaddr *sa_client)
{
int csd = -1;
int sd;
@@ -446,7 +455,7 @@
return -1;
}
-void stop_accepting_requests(pool* pconf)
+void stop_accepting_connections(pool* pconf)
{
listen_rec *lr;
1.70 +5 -9 apache-apr/pthreads/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -u -r1.69 -r1.70
--- http_main.c 1999/04/14 21:03:29 1.69
+++ http_main.c 1999/04/14 21:38:29 1.70
@@ -92,9 +92,6 @@
#include "util_script.h" /* to force util_script.c linking */
#include "util_uri.h"
#include "scoreboard.h"
-/* XXX - the accept_mutex_init call should be moved to http_accept.c. Until
- * that... - mvsk */
-#include "acceptlock.h"
#include "http_accept.h"
#include <poll.h>
@@ -405,7 +402,7 @@
static void graceful_killer(void)
{
- stop_accepting_requests(pconf);
+ stop_accepting_connections(pconf);
}
int ap_get_timeout(request_rec *r)
@@ -425,7 +422,6 @@
* when it's safe in the single Listen case. We haven't defined this yet
* for the hybrid server. ZZZ
*/
-#define SAFE_ACCEPT(stmt) do {stmt;} while(0)
static void usage(char *bin)
{
@@ -1756,7 +1752,7 @@
while (1) {
(void) ap_update_child_status(process_slot, thread_slot,
SERVER_READY,
(request_rec *) NULL);
- csd = get_request(&sa_client);
+ csd = get_connection(&sa_client);
if (csd < 0) {
break;
}
@@ -1934,7 +1930,7 @@
* Design:
*
*/
- start_accepting_requests(my_child_num);
+ start_accepting_connections(my_child_num);
return NULL;
}
@@ -1952,7 +1948,7 @@
/*stuff to do before we switch id's, so we have permissions.*/
reopen_scoreboard(pchild);
- init_accept(pchild, ap_threads_per_child, ap_acceptors_per_child);
+ accept_child_init(pchild, ap_threads_per_child, ap_acceptors_per_child);
set_group_privs();
@@ -2312,7 +2308,7 @@
ap_set_version();
ap_init_modules(pconf, server_conf);
version_locked++;
- SAFE_ACCEPT(accept_mutex_init(pconf));
+ accept_parent_init(pconf);
if (!is_graceful) {
reinit_scoreboard(pconf);
}