From 064a1ffbff2a66fcc1c9c4260571a276cebbc526 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Mon, 7 Apr 2008 09:53:58 +0000 Subject: [PATCH] Remove calls to ap_graceful_stop_signalled, and replace by using ap_mpm_query 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 | 8 +++++++- modules/http/http_protocol.c | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/http/http_core.c b/modules/http/http_core.c index b4cafaf435..faf47b671e 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -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); diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 87f3f3079a..d50353c50f 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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; -- 2.40.0