mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Use ap_state_query() to fix many modules that were not correctly initializing
if they were not active during server startup but got enabled later during a graceful restart (in which case they need to do all work during a single config run). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1070153 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
|
||||
#include "httpd.h"
|
||||
#include "http_config.h"
|
||||
#include "http_core.h"
|
||||
#include "http_log.h"
|
||||
#include "http_protocol.h"
|
||||
#include "util_mutex.h"
|
||||
@@ -117,35 +118,19 @@ static int exipc_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
static int exipc_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
apr_pool_t *ptemp, server_rec *s)
|
||||
{
|
||||
void *data; /* These two help ensure that we only init once. */
|
||||
const char *userdata_key;
|
||||
apr_status_t rs;
|
||||
exipc_data *base;
|
||||
const char *tempdir;
|
||||
|
||||
|
||||
/*
|
||||
* The following checks if this routine has been called before.
|
||||
* This is necessary because the parent process gets initialized
|
||||
* a couple of times as the server starts up, and we don't want
|
||||
* to create any more mutexes and shared memory segments than
|
||||
* we're actually going to use.
|
||||
*
|
||||
* The key needs to be unique for the entire web server, so put
|
||||
* the module name in it.
|
||||
* Do nothing if we are not creating the final configuration.
|
||||
* The parent process gets initialized a couple of times as the
|
||||
* server starts up, and we don't want to create any more mutexes
|
||||
* and shared memory segments than we're actually going to use.
|
||||
*/
|
||||
userdata_key = "example_ipc_init_module";
|
||||
apr_pool_userdata_get(&data, userdata_key, s->process->pool);
|
||||
if (!data) {
|
||||
/*
|
||||
* If no data was found for our key, this must be the first
|
||||
* time the module is initialized. Put some data under that
|
||||
* key and return.
|
||||
*/
|
||||
apr_pool_userdata_set((const void *) 1, userdata_key,
|
||||
apr_pool_cleanup_null, s->process->pool);
|
||||
if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG)
|
||||
return OK;
|
||||
} /* Kilroy was here */
|
||||
|
||||
/*
|
||||
* The shared memory allocation routines take a file name.
|
||||
|
Reference in New Issue
Block a user