On Fri, 2007-10-05 at 15:37 +1000, Bojan Smojver wrote:
> - make conn->pool have/own its own allocator
> - destroy, rather then clear conn->pool on connection close
Example patch attached.
--
Bojan
--- httpd-2.2.6/server/core.c 2007-08-07 22:12:20.000000000 +1000
+++ httpd-2.2.6-patched/server/core.c 2007-10-05 15:57:36.000000000 +1000
@@ -3872,7 +3872,21 @@
apr_bucket_alloc_t *alloc)
{
apr_status_t rv;
- conn_rec *c = (conn_rec *) apr_pcalloc(ptrans, sizeof(conn_rec));
+ apr_allocator_t *aa;
+ apr_pool_t *pool;
+ apr_bucket_alloc_t *ba;
+ conn_rec *c;
+
+ apr_allocator_create(&aa);
+ apr_pool_create_ex(&pool,ptrans,NULL,aa);
+ if (aa) {
+ apr_allocator_owner_set(aa, pool);
+ }
+ apr_pool_tag(pool, "connection");
+
+ ba = apr_bucket_alloc_create(pool);
+
+ c = apr_pcalloc(pool, sizeof(conn_rec));
c->sbh = sbh;
(void)ap_update_child_status(c->sbh, SERVER_BUSY_READ, (request_rec *)NULL);
@@ -3880,10 +3894,10 @@
/* Got a connection structure, so initialize what fields we can
* (the rest are zeroed out by pcalloc).
*/
- c->conn_config = ap_create_conn_config(ptrans);
- c->notes = apr_table_make(ptrans, 5);
+ c->conn_config = ap_create_conn_config(pool);
+ c->notes = apr_table_make(pool, 5);
- c->pool = ptrans;
+ c->pool = pool;
if ((rv = apr_socket_addr_get(&c->local_addr, APR_LOCAL, csd))
!= APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_INFO, rv, server,
@@ -3905,7 +3919,7 @@
c->base_server = server;
c->id = id;
- c->bucket_alloc = alloc;
+ c->bucket_alloc = ba;
return c;
}