[MAJOR] ported pendconn to mempools v2
A pool_destroy() was also missing in deinit()
diff --git a/include/proto/queue.h b/include/proto/queue.h
index 4370cb3..092747a 100644
--- a/include/proto/queue.h
+++ b/include/proto/queue.h
@@ -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);
diff --git a/include/types/queue.h b/include/types/queue.h
index a8e7d8b..922aa92 100644
--- a/include/types/queue.h
+++ b/include/types/queue.h
@@ -34,10 +34,6 @@
struct server *srv; /* the server we are waiting for */
};
-#define sizeof_pendconn sizeof(struct pendconn)
-extern void **pool_pendconn;
-
-
#endif /* _TYPES_QUEUE_H */
/*
diff --git a/src/haproxy.c b/src/haproxy.c
index 59c6149..c88bffc 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -374,9 +374,10 @@
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 @@
pool_destroy2(pool2_task);
pool_destroy(pool_capture);
pool_destroy(pool_appsess);
+ pool_destroy2(pool2_pendconn);
if (have_appsession) {
pool_destroy(apools.serverid);
diff --git a/src/queue.c b/src/queue.c
index 37d3ed8..a4670a8 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -11,6 +11,7 @@
*/
#include <common/config.h>
+#include <common/memory.h>
#include <common/time.h>
#include <types/proxy.h>
@@ -21,7 +22,14 @@
#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 *p;
- p = pool_alloc(pendconn);
+ p = pool_alloc2(pool2_pendconn);
if (!p)
return NULL;
@@ -136,7 +144,7 @@
else
p->sess->be->nbpend--;
p->sess->be->totpend--;
- pool_free(pendconn, p);
+ pool_free2(pool2_pendconn, p);
}