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.
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 89817df..9e40887 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -586,11 +586,6 @@
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 @@
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 @@
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 @@
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;