[MAJOR] ported pendconn to mempools v2
A pool_destroy() was also missing in deinit()
This commit is contained in:
parent
7341d94c5d
commit
e4d7e55061
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
|
14
src/queue.c
14
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 *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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue