]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Apply Ben H's patch to the winnt mpm...
authorBill Stoddard <stoddard@apache.org>
Mon, 11 Oct 1999 17:33:24 +0000 (17:33 +0000)
committerBill Stoddard <stoddard@apache.org>
Mon, 11 Oct 1999 17:33:24 +0000 (17:33 +0000)
Well this was thought provoking.

Drive out the use of malloc in two places.

In listen.c, using the global process pool instead.  That changes the
API into listen so that a process is passed in rather than the config
pool.  That's all was easy.

The pain is propogating a change into all N of the mpm, they
are all similar but different in their use of listen.c  There
is a lot to dislike about similar but code scattered code.

I changed the N setup_listener routines, they now take only
the server since they can dig the config and global pool
out of there.

Free today: ap_setup_prelinked_modules now takes the process so it
can allocate it's table in the process's pool rathern than use
malloc.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83962 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/mpm_winnt.c

index db477bf2e16fb614eca185a4ee219fe7b9df7e14..ed41a6288d1be70c446503ff64efad447f360cfa 100644 (file)
@@ -364,7 +364,7 @@ static ap_inline ap_listen_rec *find_ready_listener(fd_set * main_fds)
     }
     return NULL;
 }
-static int setup_listeners(ap_context_t *pconf, server_rec *s)
+static int setup_listeners(server_rec *s)
 {
     ap_listen_rec *lr;
     int num_listeners = 0;
@@ -373,7 +373,7 @@ static int setup_listeners(ap_context_t *pconf, server_rec *s)
     /* Setup the listeners */
     FD_ZERO(&listenfds);
 
-    if (ap_listen_open(pconf, s->port)) {
+    if (ap_listen_open(s->process, s->port)) {
        return 0;
     }
     for (lr = ap_listeners; lr; lr = lr->next) {
@@ -393,7 +393,7 @@ static int setup_listeners(ap_context_t *pconf, server_rec *s)
     return num_listeners;
 }
 
-static int setup_inherited_listeners(ap_context_t *p, server_rec *s)
+static int setup_inherited_listeners(server_rec *s)
 {
     WSAPROTOCOL_INFO WSAProtocolInfo;
     HANDLE pipe;
@@ -409,7 +409,7 @@ static int setup_inherited_listeners(ap_context_t *p, server_rec *s)
 
     if (ap_listeners == NULL) {
         ap_listen_rec *lr;
-        lr = malloc(sizeof(ap_listen_rec));
+        lr = ap_palloc(s->process->pool, sizeof(ap_listen_rec));
         if (!lr)
             return 0;
         lr->sd = NULL;
@@ -1037,10 +1037,10 @@ static void worker_main()
 
     /* start_mutex obtained, continue into the select() loop */
     if (one_process) {
-        setup_listeners(pconf, server_conf);
+        setup_listeners(server_conf);
     } else {
         /* Get listeners from the parent process */
-        setup_inherited_listeners(pconf, server_conf);
+        setup_inherited_listeners(server_conf);
     }
 
     if (listenmaxfd == INVALID_SOCKET) {
@@ -1391,7 +1391,7 @@ static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_even
     HANDLE process_handles[MAX_PROCESSES];
     HANDLE process_kill_events[MAX_PROCESSES];
 
-    setup_listeners(pconf, s);
+    setup_listeners(s);
 
     /* Create child process 
      * Should only be one in this version of Apache for WIN32