]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MAJOR] ported pendconn to mempools v2
authorWilly Tarreau <w@1wt.eu>
Sun, 13 May 2007 18:19:55 +0000 (20:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 13 May 2007 18:19:55 +0000 (20:19 +0200)
A pool_destroy() was also missing in deinit()

include/proto/queue.h
include/types/queue.h
src/haproxy.c
src/queue.c

index 4370cb39d8d018d2a9dd9ac511a27b10479b2419..092747a03e7c2524d9cdcd44d2ae6f375961c5c9 100644 (file)
@@ -32,6 +32,9 @@
 #include <types/server.h>
 #include <types/task.h>
 
+extern struct pool_head *pool2_pendconn;
+
+int init_pendconn();
 struct session *pendconn_get_next_sess(struct server *srv, struct proxy *px);
 struct pendconn *pendconn_add(struct session *sess);
 void pendconn_free(struct pendconn *p);
index a8e7d8b016bcbc3ce5b13fe80ae867707911f212..922aa92fd05117a801ed808f962826aea883cb59 100644 (file)
@@ -34,10 +34,6 @@ struct pendconn {
        struct server *srv;             /* the server we are waiting for */
 };
 
-#define sizeof_pendconn sizeof(struct pendconn)
-extern void **pool_pendconn;
-
-
 #endif /* _TYPES_QUEUE_H */
 
 /*
index 59c61497891e81f48e646020c079cc4f307b9171..c88bffcd4df3b3147e247e30599cedc04030ace3 100644 (file)
@@ -374,9 +374,10 @@ void init(int argc, char **argv)
        localtime((time_t *)&now.tv_sec);
        start_date = now;
 
-       init_buffer();
        init_task();
        init_session();
+       init_buffer();
+       init_pendconn();
        init_proto_http();
 
        cfg_polling_mechanism = POLL_USE_SELECT;  /* select() is always available */
@@ -667,6 +668,7 @@ void deinit(void)
        pool_destroy2(pool2_task);
        pool_destroy(pool_capture);
        pool_destroy(pool_appsess);
+       pool_destroy2(pool2_pendconn);
     
        if (have_appsession) {
                pool_destroy(apools.serverid);
index 37d3ed85072bddd1d8ed27ac9aa9da2c0534d610..a4670a80c389cd2193847c047e32daa1f0e41383 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <common/config.h>
+#include <common/memory.h>
 #include <common/time.h>
 
 #include <types/proxy.h>
 #include <proto/task.h>
 
 
-void **pool_pendconn = NULL;
+struct pool_head *pool2_pendconn;
+
+/* perform minimal intializations, report 0 in case of error, 1 if OK. */
+int init_pendconn()
+{
+       pool2_pendconn = create_pool("pendconn", sizeof(struct pendconn), MEM_F_SHARED);
+       return pool2_pendconn != NULL;
+}
 
 /* returns the effective dynamic maxconn for a server, considering the minconn
  * and the proxy's usage relative to its dynamic connections limit. It is
@@ -98,7 +106,7 @@ struct pendconn *pendconn_add(struct session *sess)
 {
        struct pendconn *p;
 
-       p = pool_alloc(pendconn);
+       p = pool_alloc2(pool2_pendconn);
        if (!p)
                return NULL;
 
@@ -136,7 +144,7 @@ void pendconn_free(struct pendconn *p)
        else
                p->sess->be->nbpend--;
        p->sess->be->totpend--;
-       pool_free(pendconn, p);
+       pool_free2(pool2_pendconn, p);
 }