Hi I am working on a nginx module, where I have to manually clean up something from the shared memory when a connection drops.
I am using the following code, to clean my shared memory:
cln = ngx_pool_cleanup_add(r->connection->pool, sizeof(ngx_http_auth_ntlm_cleanup_t));
if (cln == NULL) {
DEBUG("Empty cleanup");
return NULL;
}
cln->handler = ngx_http_auth_ntlm_cleanup;
cleanup = cln->data;
cleanup->shm_zone = shm_zone;
cleanup->node = ctx_node;
It works perfectly when I change the cleanup to r->pool. However with "r->connection->pool" the function ngx_http_auth_ntlm_cleanup is never called, so my modul runs out of memory after about 200 connections. Is there a way to determine when is a connection dropped, so i can clean up the shared memory.