]> granicus.if.org Git - apache/commitdiff
change the way the cgid daemon restart logic determines whether
authorJeff Trawick <trawick@apache.org>
Sat, 13 Dec 2003 19:09:00 +0000 (19:09 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 13 Dec 2003 19:09:00 +0000 (19:09 +0000)
or not the MPM is still running...   now it works with prefork
MPM too

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

modules/generators/mod_cgid.c

index c4cd28d576c687e58ab0dcfaa7f1d82f3a280e87..6b5f5fd8f02718e9da481590d4afe32da65f3d52 100644 (file)
@@ -270,6 +270,8 @@ static char **create_argv(apr_pool_t *p, char *path, char *user, char *group,
 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 @@ static void cgid_maint(int reason, void *data, apr_wait_t status)
             /* 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: