From 894610212596c35aade07a4d0af9d5e7fd6245c7 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Tue, 3 Oct 2017 11:15:54 +0300 Subject: [PATCH] lib-master: Use pooled memory for haproxy --- src/lib-master/master-service-haproxy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); -- 2.47.3