Index: server/config.c =================================================================== --- server/config.c (revision 593813) +++ server/config.c (working copy) @@ -1884,6 +1884,7 @@ s->keep_alive_timeout = 0; s->keep_alive = -1; s->keep_alive_max = -1; + s->keep_alive_while_exiting = -1; s->error_log = main_server->error_log; s->loglevel = main_server->loglevel; /* useful default, otherwise we get a port of 0 on redirects */ @@ -1931,6 +1932,9 @@ if (virt->keep_alive == -1) virt->keep_alive = main_server->keep_alive; + if (virt->keep_alive_while_exiting == -1) + virt->keep_alive_while_exiting = main_server->keep_alive_while_exiting; + if (virt->keep_alive_max == -1) virt->keep_alive_max = main_server->keep_alive_max; @@ -1974,6 +1978,7 @@ s->keep_alive_timeout = apr_time_from_sec(DEFAULT_KEEPALIVE_TIMEOUT); s->keep_alive_max = DEFAULT_KEEPALIVE; s->keep_alive = 1; + s->keep_alive_while_exiting = 0; s->next = NULL; s->addrs = apr_pcalloc(p, sizeof(server_addr_rec)); Index: modules/http/http_core.c =================================================================== --- modules/http/http_core.c (revision 593813) +++ modules/http/http_core.c (working copy) @@ -78,6 +78,18 @@ return NULL; } +static const char *set_keep_alive_while_exiting(cmd_parms *cmd, void *dummy, + int arg) +{ + const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); + if (err != NULL) { + return err; + } + + cmd->server->keep_alive_while_exiting = arg != 0; + return NULL; +} + static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy, const char *arg) { @@ -112,6 +124,9 @@ "or 0 for infinite"), AP_INIT_TAKE1("KeepAlive", set_keep_alive, NULL, RSRC_CONF, "Whether persistent connections should be On or Off"), + AP_INIT_FLAG("KeepAliveWhileExiting", set_keep_alive_while_exiting, NULL, RSRC_CONF, + "Whether connection persistence should be respected when the " + "MPM process is exiting (On or Off)"), AP_INIT_TAKE1("KeptBodySize", set_kept_body_size, NULL, ACCESS_CONF, "Maximum size of request bodies kept aside for use by filters"), { NULL } @@ -221,7 +236,7 @@ ap_update_child_status(c->sbh, SERVER_BUSY_KEEPALIVE, NULL); - if (ap_graceful_stop_signalled()) + if (!c->base_server->keep_alive_while_exiting && ap_graceful_stop_signalled()) break; if (!csd) { Index: include/ap_mmn.h =================================================================== --- include/ap_mmn.h (revision 593813) +++ include/ap_mmn.h (working copy) @@ -140,6 +140,7 @@ * 20071023.3 (2.3.0-dev) Declare ap_time_process_request() as part of the * public scoreboard API. * 20071108.1 (2.3.0-dev) Add the optional kept_body brigade to request_rec + * 20071115.2 (2.3.0-dev) Add keep_alive_while_exiting to server_rec */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ Index: include/httpd.h =================================================================== --- include/httpd.h (revision 593813) +++ include/httpd.h (working copy) @@ -1229,6 +1229,9 @@ /** The server request scheme for redirect responses */ const char *server_scheme; + /** Respect previous keep-alive determination when MPM + * process is exiting? */ + int keep_alive_while_exiting; }; typedef struct core_output_filter_ctx {