]> granicus.if.org Git - apache/commitdiff
Remove calls to ap_graceful_stop_signalled, and replace by using ap_mpm_query
authorPaul Querna <pquerna@apache.org>
Mon, 7 Apr 2008 09:53:58 +0000 (09:53 +0000)
committerPaul Querna <pquerna@apache.org>
Mon, 7 Apr 2008 09:53:58 +0000 (09:53 +0000)
to determine if the MPM is trying to stop the process.

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

modules/http/http_core.c
modules/http/http_protocol.c

index b4cafaf435e2632c27e12a93c166cf3cf630f353..faf47b671edc9651de9ad5956617af9de4d2b7da 100644 (file)
@@ -221,8 +221,14 @@ static int ap_process_http_connection(conn_rec *c)
 
         ap_update_child_status(c->sbh, SERVER_BUSY_KEEPALIVE, NULL);
 
-        if (ap_graceful_stop_signalled())
+        int mpm_state = 0;
+        if (ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state)) {
             break;
+        }
+
+        if (mpm_state == AP_MPMQ_STOPPING) {
+          break;
+        }
 
         if (!csd) {
             csd = ap_get_module_config(c->conn_config, &core_module);
index 87f3f3079a805b521ad71698e900292cdd9f6148..d50353c50f6d0eeccd022e7914399e0d67c31515 100644 (file)
@@ -158,6 +158,21 @@ AP_IMPLEMENT_HOOK_VOID(insert_error_filter, (request_rec *r), (r))
  */
 #define METHOD_NUMBER_LAST  62
 
+static int is_mpm_running()
+{
+    int mpm_state = 0;
+
+    if (ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state)) {
+      return 0;
+    }
+  
+    if (mpm_state == AP_MPMQ_STOPPING) {
+      return 0;
+    }
+
+    return 1;
+}
+
 
 AP_DECLARE(int) ap_set_keepalive(request_rec *r)
 {
@@ -215,7 +230,7 @@ AP_DECLARE(int) ap_set_keepalive(request_rec *r)
             || apr_table_get(r->headers_in, "Via"))
         && ((ka_sent = ap_find_token(r->pool, conn, "keep-alive"))
             || (r->proto_num >= HTTP_VERSION(1,1)))
-        && !ap_graceful_stop_signalled()) {
+        && is_mpm_running()) {
         int left = r->server->keep_alive_max - r->connection->keepalives;
 
         r->connection->keepalive = AP_CONN_KEEPALIVE;