Fix: add missing child_exit hook per architecture.yml
- Add reqin_log_child_exit() to close Unix socket on child exit - Register hook with ap_hook_child_exit() - Ensures clean socket cleanup as specified in architecture.yml Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@ -591,24 +591,36 @@ static int reqin_log_post_read_request(request_rec *r)
|
|||||||
static void reqin_log_child_init(apr_pool_t *p, server_rec *s)
|
static void reqin_log_child_init(apr_pool_t *p, server_rec *s)
|
||||||
{
|
{
|
||||||
(void)p;
|
(void)p;
|
||||||
|
|
||||||
reqin_log_config_t *cfg = get_module_config(s);
|
reqin_log_config_t *cfg = get_module_config(s);
|
||||||
|
|
||||||
g_child_state.socket_fd = -1;
|
g_child_state.socket_fd = -1;
|
||||||
g_child_state.last_connect_attempt = 0;
|
g_child_state.last_connect_attempt = 0;
|
||||||
g_child_state.last_error_report = 0;
|
g_child_state.last_error_report = 0;
|
||||||
g_child_state.connect_failed = 0;
|
g_child_state.connect_failed = 0;
|
||||||
|
|
||||||
if (cfg == NULL || !cfg->enabled || cfg->socket_path == NULL) {
|
if (cfg == NULL || !cfg->enabled || cfg->socket_path == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try_connect(cfg, s);
|
try_connect(cfg, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void reqin_log_child_exit(apr_pool_t *p, server_rec *s)
|
||||||
|
{
|
||||||
|
(void)p;
|
||||||
|
(void)s;
|
||||||
|
|
||||||
|
if (g_child_state.socket_fd >= 0) {
|
||||||
|
close(g_child_state.socket_fd);
|
||||||
|
g_child_state.socket_fd = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void reqin_log_register_hooks(apr_pool_t *p)
|
static void reqin_log_register_hooks(apr_pool_t *p)
|
||||||
{
|
{
|
||||||
(void)p;
|
(void)p;
|
||||||
ap_hook_post_read_request(reqin_log_post_read_request, NULL, NULL, APR_HOOK_MIDDLE);
|
ap_hook_post_read_request(reqin_log_post_read_request, NULL, NULL, APR_HOOK_MIDDLE);
|
||||||
ap_hook_child_init(reqin_log_child_init, NULL, NULL, APR_HOOK_MIDDLE);
|
ap_hook_child_init(reqin_log_child_init, NULL, NULL, APR_HOOK_MIDDLE);
|
||||||
|
ap_hook_child_exit(reqin_log_child_exit, NULL, NULL, APR_HOOK_MIDDLE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user