mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-07 01:31:35 +00:00
MINOR: mux-h1: clean up conditions to enabled and disabled splicing
First, there is no reason to announce the splicing support at the conn-stream level when it is created, at least for now. GTUNE_USE_SPLICE option is already handled at the stream level. Second, in h1_rcv_buf(), there is no reason to test the message state to switch the H1C in splicing mode (via H1C_F_WANT_SPLICE flag). h1_process_input() already takes care to set CS_FL_MAY_SPLICE flag on the conn-stream when appropriate. Thus, in h1_rcv_buf(), we can rely on this flag to change the H1C state. Finally, if h1_rcv_pipe() is called, it means the H1C is already in the splicing mode. H1C_F_WANT_SPLICE flag is necessarily already set. Thus no reason to force it.
This commit is contained in:
parent
16b37510bc
commit
2b861bf723
22
src/mux_h1.c
22
src/mux_h1.c
@ -586,11 +586,6 @@ static struct conn_stream *h1s_new_cs(struct h1s *h1s, struct buffer *input)
|
||||
if (h1s->flags & H1S_F_NOT_FIRST)
|
||||
cs->flags |= CS_FL_NOT_FIRST;
|
||||
|
||||
if (global.tune.options & GTUNE_USE_SPLICE) {
|
||||
TRACE_STATE("notify the mux can use splicing", H1_EV_STRM_NEW, h1s->h1c->conn, h1s);
|
||||
cs->flags |= CS_FL_MAY_SPLICE;
|
||||
}
|
||||
|
||||
if (stream_create_from_cs(cs, input) < 0) {
|
||||
TRACE_DEVEL("leaving on stream creation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1s->h1c->conn, h1s);
|
||||
goto err;
|
||||
@ -616,11 +611,6 @@ static struct conn_stream *h1s_upgrade_cs(struct h1s *h1s, struct buffer *input)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (global.tune.options & GTUNE_USE_SPLICE) {
|
||||
TRACE_STATE("notify the mux can use splicing", H1_EV_STRM_NEW, h1s->h1c->conn, h1s);
|
||||
h1s->cs->flags |= CS_FL_MAY_SPLICE;
|
||||
}
|
||||
|
||||
h1s->h1c->flags |= H1C_F_ST_READY;
|
||||
TRACE_LEAVE(H1_EV_STRM_NEW, h1s->h1c->conn, h1s);
|
||||
return h1s->cs;
|
||||
@ -3349,11 +3339,9 @@ static size_t h1_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
|
||||
else
|
||||
TRACE_DEVEL("h1c ibuf not allocated", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn);
|
||||
|
||||
if (flags & CO_RFL_BUF_FLUSH) {
|
||||
if (h1m->state == H1_MSG_TUNNEL || (h1m->state == H1_MSG_DATA && h1m->curr_len)) {
|
||||
h1c->flags |= H1C_F_WANT_SPLICE;
|
||||
TRACE_STATE("Block xprt rcv_buf to flush stream's buffer (want_splice)", H1_EV_STRM_RECV, h1c->conn, h1s);
|
||||
}
|
||||
if ((flags & CO_RFL_BUF_FLUSH) && (cs->flags & CS_FL_MAY_SPLICE)) {
|
||||
h1c->flags |= H1C_F_WANT_SPLICE;
|
||||
TRACE_STATE("Block xprt rcv_buf to flush stream's buffer (want_splice)", H1_EV_STRM_RECV, h1c->conn, h1s);
|
||||
}
|
||||
else {
|
||||
if (((flags & CO_RFL_KEEP_RECV) || (h1m->state != H1_MSG_DONE)) && !(h1c->wait_event.events & SUB_RETRY_RECV))
|
||||
@ -3451,10 +3439,6 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!(h1c->flags & H1C_F_WANT_SPLICE)) {
|
||||
h1c->flags |= H1C_F_WANT_SPLICE;
|
||||
TRACE_STATE("Block xprt rcv_buf to perform splicing", H1_EV_STRM_RECV, cs->conn, h1s);
|
||||
}
|
||||
if (h1s_data_pending(h1s)) {
|
||||
TRACE_STATE("flush input buffer before splicing", H1_EV_STRM_RECV, cs->conn, h1s);
|
||||
goto end;
|
||||
|
Loading…
Reference in New Issue
Block a user