From 1cb3075ed6aa9e730772d3145624c62c556047b3 Mon Sep 17 00:00:00 2001 From: Thomas Porzelt Date: Sun, 11 Jan 2009 04:13:49 +0100 Subject: [PATCH] fix bogus action context cleanup in mod_status --- src/modules/mod_status.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/modules/mod_status.c b/src/modules/mod_status.c index c02abad..448d968 100644 --- a/src/modules/mod_status.c +++ b/src/modules/mod_status.c @@ -142,6 +142,9 @@ typedef struct mod_status_wrk_data mod_status_wrk_data; struct mod_status_con_data; typedef struct mod_status_con_data mod_status_con_data; +struct mod_status_job; +typedef struct mod_status_job mod_status_job; + struct mod_status_con_data { guint worker_ndx; connection_state_t state; @@ -161,6 +164,11 @@ struct mod_status_wrk_data { GArray *connections; }; +struct mod_status_job { + vrequest *vr; + gpointer *context; +}; + /* the CollectFunc */ static gpointer status_collect_func(worker *wrk, gpointer fdata) { @@ -193,9 +201,15 @@ static gpointer status_collect_func(worker *wrk, gpointer fdata) { /* the CollectCallback */ static void status_collect_cb(gpointer cbdata, gpointer fdata, GPtrArray *result, gboolean complete) { - vrequest *vr = cbdata; + mod_status_job *job = cbdata; + vrequest *vr = job->vr; UNUSED(fdata); + /* clear context so it doesn't get cleaned up anymore */ + *(job->context) = NULL; + + g_slice_free(mod_status_job, job); + if (complete) { GString *css; GString *tmpstr; @@ -458,10 +472,16 @@ static handler_t status_page_handle(vrequest *vr, gpointer param, gpointer *cont if (vr->state == VRS_HANDLE_REQUEST_HEADERS) { collect_info *ci; + mod_status_job *j = g_slice_new(mod_status_job); + j->vr = vr; + j->context = context; + VR_DEBUG(vr, "%s", "collecting stats..."); + /* abuse fdata as pointer to plugin */ - ci = collect_start(vr->con->wrk, status_collect_func, param, NULL, status_collect_cb, vr); + ci = collect_start(vr->con->wrk, status_collect_func, param, NULL, status_collect_cb, j); *context = ci; + return HANDLER_WAIT_FOR_EVENT; }