stoddard    99/10/11 10:33:25

  Modified:    src/modules/mpm/winnt winnt.c
  Log:
  Apply Ben H's patch to the winnt mpm...
  
  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.
  
  Revision  Changes    Path
  1.20      +7 -7      apache-2.0/src/modules/mpm/winnt/winnt.c
  
  Index: winnt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/winnt.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- winnt.c   1999/10/11 15:40:00     1.19
  +++ winnt.c   1999/10/11 17:33:24     1.20
  @@ -364,7 +364,7 @@
       }
       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 @@
       /* 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 @@
       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 @@
   
       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 @@
   
       /* 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 @@
       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 
  
  
  

Reply via email to