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...@apache.org on 2003/12/13 20:09:00 UTC

cvs commit: httpd-2.0/modules/generators mod_cgid.c

trawick     2003/12/13 11:09:00

  Modified:    modules/generators mod_cgid.c
  Log:
  change the way the cgid daemon restart logic determines whether
  or not the MPM is still running...   now it works with prefork
  MPM too
  
  Revision  Changes    Path
  1.161     +13 -4     httpd-2.0/modules/generators/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
  retrieving revision 1.160
  retrieving revision 1.161
  diff -u -r1.160 -r1.161
  --- mod_cgid.c	16 Nov 2003 02:09:13 -0000	1.160
  +++ mod_cgid.c	13 Dec 2003 19:09:00 -0000	1.161
  @@ -270,6 +270,8 @@
   static void cgid_maint(int reason, void *data, apr_wait_t status)
   {
       apr_proc_t *proc = data;
  +    int mpm_state;
  +    int stopping;
   
       switch (reason) {
           case APR_OC_REASON_DEATH:
  @@ -277,10 +279,17 @@
               /* If apache is not terminating or restarting,
                * restart the cgid daemon
                */
  -            if (!ap_graceful_stop_signalled()) {
  -                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                              "cgid daemon process died, restarting");
  -               cgid_start(root_pool, root_server, proc);
  +            stopping = 1; /* if MPM doesn't support query,
  +                           * assume we shouldn't restart daemon
  +                           */
  +            if (ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state) == APR_SUCCESS &&
  +                mpm_state != AP_MPMQ_STOPPING) {
  +                stopping = 0;
  +            }
  +            if (!stopping) {
  +                ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  +                             "cgid daemon process died, restarting");
  +                cgid_start(root_pool, root_server, proc);
               }
               break;
           case APR_OC_REASON_RESTART: