From: Aki Tuomi Date: Tue, 3 Oct 2017 08:15:54 +0000 (+0300) Subject: lib-master: Use pooled memory for haproxy X-Git-Tag: 2.3.0.rc1~830 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=894610212596c35aade07a4d0af9d5e7fd6245c7;p=thirdparty%2Fdovecot%2Fcore.git lib-master: Use pooled memory for haproxy --- diff --git a/src/lib-master/master-service-haproxy.c b/src/lib-master/master-service-haproxy.c index a58cfc502b..384b33772f 100644 --- a/src/lib-master/master-service-haproxy.c +++ b/src/lib-master/master-service-haproxy.c @@ -66,6 +66,8 @@ struct haproxy_data_v2 { struct master_service_haproxy_conn { struct master_service_connection conn; + pool_t pool; + struct master_service_haproxy_conn *prev, *next; struct master_service *service; @@ -83,7 +85,7 @@ master_service_haproxy_conn_free(struct master_service_haproxy_conn *hpconn) io_remove(&hpconn->io); timeout_remove(&hpconn->to); - i_free(hpconn); + pool_unref(&hpconn->pool); } static void @@ -492,6 +494,7 @@ void master_service_haproxy_new(struct master_service *service, struct master_service_connection *conn) { struct master_service_haproxy_conn *hpconn; + pool_t pool; if (!master_service_haproxy_conn_is_trusted(service, conn)) { i_warning("haproxy: Client not trusted (rip=%s)", @@ -500,7 +503,9 @@ void master_service_haproxy_new(struct master_service *service, return; } - hpconn = i_new(struct master_service_haproxy_conn, 1); + pool = pool_alloconly_create("haproxy connection", 128); + hpconn = p_new(pool, struct master_service_haproxy_conn, 1); + hpconn->pool = pool; hpconn->conn = *conn; hpconn->service = service; DLLIST_PREPEND(&service->haproxy_conns, hpconn);