#ifndef _PROTO_BUFFERS_H
#define _PROTO_BUFFERS_H
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <common/config.h>
+#include <common/memory.h>
#include <types/buffers.h>
+extern struct pool_head *pool2_buffer;
+
+/* perform minimal intializations, report 0 in case of error, 1 if OK. */
+int init_buffer();
+
/* Initializes all fields in the buffer. The ->rlim field is initialized last
* so that the compiler can optimize it away if changed immediately after the
* call to this function.
char data[BUFSIZE];
};
-#define sizeof_buffer sizeof(struct buffer)
-extern void **pool_buffer;
-
#endif /* _TYPES_BUFFERS_H */
#include <string.h>
#include <common/config.h>
+#include <common/memory.h>
#include <proto/buffers.h>
-void **pool_buffer = NULL;
+struct pool_head *pool2_buffer;
+
+
+/* perform minimal intializations, report 0 in case of error, 1 if OK. */
+int init_buffer()
+{
+ pool2_buffer = create_pool("buffer", sizeof(struct buffer), MEM_F_SHARED);
+ return pool2_buffer != NULL;
+}
+
/* writes <len> bytes from message <msg> to buffer <buf>. Returns 0 in case of
* success, or the number of bytes available otherwise.
write(1, trash, len);
}
- if ((s->req = pool_alloc(buffer)) == NULL) { /* no memory */
+ if ((s->req = pool_alloc2(pool2_buffer)) == NULL) { /* no memory */
if (txn->hdr_idx.v != NULL)
pool_free_to(p->hdr_idx_pool, txn->hdr_idx.v);
if (txn->rsp.cap != NULL)
s->req->wto = s->be->srvtimeout;
s->req->cto = s->be->srvtimeout;
- if ((s->rep = pool_alloc(buffer)) == NULL) { /* no memory */
- pool_free(buffer, s->req);
+ if ((s->rep = pool_alloc2(pool2_buffer)) == NULL) { /* no memory */
+ pool_free2(pool2_buffer, s->req);
if (txn->hdr_idx.v != NULL)
pool_free_to(p->hdr_idx_pool, txn->hdr_idx.v);
if (txn->rsp.cap != NULL)
localtime((time_t *)&now.tv_sec);
start_date = now;
+ init_buffer();
init_task();
init_session();
init_proto_http();
if (fdtab) free(fdtab);
pool_destroy2(pool2_session);
- pool_destroy(pool_buffer);
+ pool_destroy2(pool2_buffer);
pool_destroy(pool_requri);
pool_destroy2(pool2_task);
pool_destroy(pool_capture);
#include <types/proxy.h>
#include <types/server.h>
+#include <proto/buffers.h>
#include <proto/hdr_idx.h>
#include <proto/session.h>
#include <proto/queue.h>
if (s->pend_pos)
pendconn_free(s->pend_pos);
if (s->req)
- pool_free(buffer, s->req);
+ pool_free2(pool2_buffer, s->req);
if (s->rep)
- pool_free(buffer, s->rep);
+ pool_free2(pool2_buffer, s->rep);
if (txn->hdr_idx.v != NULL)
pool_free_to(s->fe->hdr_idx_pool, txn->hdr_idx.v);