[MEDIUM] make it possible to change the buffer size in the configuration
The new tune.bufsize and tune.maxrewrite global directives allow one to
change the buffer size and the maxrewrite size. Right now, setting bufsize
too low will block stats sockets which will not be able to write at all.
An error checking must be added to buffer_write_chunk() so that if it
cannot write its message to an empty buffer, it causes the caller to abort.
diff --git a/src/client.c b/src/client.c
index 92baefc..76ea122 100644
--- a/src/client.c
+++ b/src/client.c
@@ -384,7 +384,7 @@
if ((s->req = pool_alloc2(pool2_buffer)) == NULL)
goto out_fail_req; /* no memory */
- s->req->size = BUFSIZE;
+ s->req->size = global.tune.bufsize;
buffer_init(s->req);
s->req->prod = &s->si[0];
s->req->cons = &s->si[1];
@@ -393,7 +393,7 @@
s->req->flags |= BF_READ_ATTACHED; /* the producer is already connected */
if (p->mode == PR_MODE_HTTP) { /* reserve some space for header rewriting */
- s->req->max_len -= MAXREWRITE;
+ s->req->max_len -= global.tune.maxrewrite;
s->req->flags |= BF_READ_DONTWAIT; /* one read is usually enough */
}
@@ -411,7 +411,7 @@
if ((s->rep = pool_alloc2(pool2_buffer)) == NULL)
goto out_fail_rep; /* no memory */
- s->rep->size = BUFSIZE;
+ s->rep->size = global.tune.bufsize;
buffer_init(s->rep);
s->rep->prod = &s->si[1];
s->rep->cons = &s->si[0];