mirror of
https://github.com/haproxy/haproxy.git
synced 2026-03-27 21:06:45 -04:00
MEDIUM: stream: Try to use small buffer when TCP stream is queued
It was performed when an HTX stream was queued. Small requests were moved in small buffers. Here we do the same but for TCP streams.
This commit is contained in:
parent
5acdda4eed
commit
181cd8ba8a
1 changed files with 14 additions and 3 deletions
17
src/stream.c
17
src/stream.c
|
|
@ -2512,11 +2512,22 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
|||
if (scb->state == SC_ST_ASS && srv && srv->rdr_len && (s->flags & SF_REDIRECTABLE))
|
||||
http_perform_server_redirect(s, scb);
|
||||
|
||||
if (unlikely(scb->state == SC_ST_QUE && IS_HTX_STRM(s))) {
|
||||
if (unlikely(scb->state == SC_ST_QUE)) {
|
||||
struct buffer sbuf = BUF_NULL;
|
||||
|
||||
if (!htx_move_to_small_buffer(&sbuf, &req->buf))
|
||||
break;
|
||||
if (IS_HTX_STRM(s)) {
|
||||
if (!htx_move_to_small_buffer(&sbuf, &req->buf))
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (b_size(&req->buf) == global.tune.bufsize_small ||
|
||||
b_data(&req->buf) > global.tune.bufsize_small)
|
||||
break;
|
||||
if (!b_alloc_small(&sbuf))
|
||||
break;
|
||||
b_xfer(&sbuf, &req->buf, b_data(&req->buf));
|
||||
}
|
||||
|
||||
b_free(&req->buf);
|
||||
offer_buffers(s, 1);
|
||||
req->buf = sbuf;
|
||||
|
|
|
|||
Loading…
Reference in a new issue