From: Christopher Faulet Date: Fri, 17 Mar 2023 14:45:58 +0000 (+0100) Subject: MINOR: stconn/channel: Move CF_EXPECT_MORE into the SC and rename it X-Git-Tag: v2.8-dev7~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84d3ef982c68a8da8b82531df76ebc73765bfdcb;p=thirdparty%2Fhaproxy.git MINOR: stconn/channel: Move CF_EXPECT_MORE into the SC and rename it The channel flag CF_EXPECT_MORE is renamed to SC_FL_SND_EXP_MORE and moved into the stream-connector. --- diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index 69db465cc4..a69ce46cd2 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -110,8 +110,7 @@ #define CF_AUTO_CONNECT 0x00800000 /* consumer may attempt to establish a new connection */ #define CF_DONT_READ 0x01000000 /* disable reading for now */ -#define CF_EXPECT_MORE 0x02000000 /* more data expected to be sent very soon (one-shoot) */ -/* unused 0x04000000 - 0x08000000 */ +/* unused 0x02000000 - 0x08000000 */ #define CF_WAKE_ONCE 0x10000000 /* pretend there is activity on this channel (one-shoot) */ #define CF_FLT_ANALYZE 0x20000000 /* at least one filter is still analyzing this channel */ @@ -140,9 +139,9 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim _(CF_WAKE_WRITE, _(CF_SHUTW, _(CF_SHUTW_NOW, _(CF_AUTO_CLOSE, _(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA, _(CF_KERN_SPLICING, - _(CF_AUTO_CONNECT, _(CF_DONT_READ, _(CF_EXPECT_MORE, + _(CF_AUTO_CONNECT, _(CF_DONT_READ, _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE, - _(CF_EOI, _(CF_ISRESP))))))))))))))))))))); + _(CF_EOI, _(CF_ISRESP)))))))))))))))))))); /* epilogue */ _(~0U); return buf; diff --git a/include/haproxy/stconn-t.h b/include/haproxy/stconn-t.h index 4ac2237cac..285b35c29d 100644 --- a/include/haproxy/stconn-t.h +++ b/include/haproxy/stconn-t.h @@ -129,6 +129,7 @@ enum sc_flags { SC_FL_RCV_ONCE = 0x00000400, /* Don't loop to receive data. cleared after a sucessful receive */ SC_FL_SND_ASAP = 0x00000800, /* Don't wait for sending. cleared when all data were sent */ SC_FL_SND_NEVERWAIT = 0x00001000, /* Never wait for sending (permanent) */ + SC_FL_SND_EXP_MORE = 0x00001000, /* More data expected to be sent very soon. cleared when all data were sent */ }; /* This function is used to report flags in debugging tools. Please reflect @@ -144,7 +145,7 @@ static forceinline char *sc_show_flags(char *buf, size_t len, const char *delim, _(SC_FL_ISBACK, _(SC_FL_NOLINGER, _(SC_FL_NOHALF, _(SC_FL_DONT_WAKE, _(SC_FL_INDEP_STR, _(SC_FL_WONT_READ, _(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM, - _(SC_FL_RCV_ONCE, _(SC_FL_SND_ASAP, _(SC_FL_SND_NEVERWAIT))))))))))); + _(SC_FL_RCV_ONCE, _(SC_FL_SND_ASAP, _(SC_FL_SND_NEVERWAIT, _(SC_FL_SND_EXP_MORE)))))))))))); /* epilogue */ _(~0U); return buf; diff --git a/src/http_ana.c b/src/http_ana.c index ff3f3a366f..ae97b33c17 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -958,7 +958,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) msg->msg_state = HTTP_MSG_ENDING; ending: - req->flags &= ~CF_EXPECT_MORE; /* no more data are expected */ + s->scb->flags &= ~SC_FL_SND_EXP_MORE; /* no more data are expected to be send */ /* other states, ENDING...TUNNEL */ if (msg->msg_state >= HTTP_MSG_DONE) @@ -1040,7 +1040,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) channel_dont_close(req); /* We know that more data are expected, but we couldn't send more that - * what we did. So we always set the CF_EXPECT_MORE flag so that the + * what we did. So we always set the SC_FL_SND_EXP_MORE flag so that the * system knows it must not set a PUSH on this first part. Interactive * modes are already handled by the stream sock layer. We must not do * this in content-length mode because it could present the MSG_MORE @@ -1048,7 +1048,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) * additional delay to be observed by the receiver. */ if (HAS_REQ_DATA_FILTERS(s)) - req->flags |= CF_EXPECT_MORE; + s->scb->flags |= SC_FL_SND_EXP_MORE; DBG_TRACE_DEVEL("waiting for more data to forward", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn); @@ -1638,7 +1638,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit) txn->status = 0; s->logs.logwait = 0; s->logs.level = 0; - s->res.flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */ + s->scf->flags &= ~SC_FL_SND_EXP_MORE; /* speed up sending a previous response */ http_reply_and_close(s, txn->status, NULL); DBG_TRACE_DEVEL("leaving by closing K/A connection", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn); @@ -2072,7 +2072,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit msg->msg_state = HTTP_MSG_ENDING; ending: - res->flags &= ~CF_EXPECT_MORE; /* no more data are expected */ + s->scf->flags &= ~SC_FL_SND_EXP_MORE; /* no more data are expected to be sent */ /* other states, ENDING...TUNNEL */ if (msg->msg_state >= HTTP_MSG_DONE) @@ -2143,7 +2143,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit channel_dont_close(res); /* We know that more data are expected, but we couldn't send more that - * what we did. So we always set the CF_EXPECT_MORE flag so that the + * what we did. So we always set the SC_FL_SND_EXP_MORE flag so that the * system knows it must not set a PUSH on this first part. Interactive * modes are already handled by the stream sock layer. We must not do * this in content-length mode because it could present the MSG_MORE @@ -2151,7 +2151,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit * additional delay to be observed by the receiver. */ if (HAS_RSP_DATA_FILTERS(s)) - res->flags |= CF_EXPECT_MORE; + s->scf->flags |= SC_FL_SND_EXP_MORE; /* the stream handler will take care of timeouts and errors */ DBG_TRACE_DEVEL("waiting for more data to forward", diff --git a/src/stconn.c b/src/stconn.c index 3f607d3d83..134af8f420 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1066,7 +1066,7 @@ static void sc_notify(struct stconn *sc) */ if (!channel_is_empty(ic) && sc_ep_test(sco, SE_FL_WAIT_DATA) && - (!(ic->flags & CF_EXPECT_MORE) || c_full(ic) || ci_data(ic) == 0 || ic->pipe)) { + (!(sc->flags & SC_FL_SND_EXP_MORE) || c_full(ic) || ci_data(ic) == 0 || ic->pipe)) { int new_len, last_len; last_len = co_data(ic); @@ -1593,7 +1593,7 @@ static int sc_conn_send(struct stconn *sc) if ((!(sc->flags & (SC_FL_SND_ASAP|SC_FL_SND_NEVERWAIT)) && ((oc->to_forward && oc->to_forward != CHN_INFINITE_FORWARD) || - (oc->flags & CF_EXPECT_MORE) || + (sc->flags & SC_FL_SND_EXP_MORE) || (IS_HTX_STRM(s) && (!(oc->flags & (CF_EOI|CF_SHUTR)) && htx_expect_more(htxbuf(&oc->buf)))))) || ((oc->flags & CF_ISRESP) && @@ -1637,8 +1637,7 @@ static int sc_conn_send(struct stconn *sc) if (!co_data(oc)) { /* Always clear both flags once everything has been sent, they're one-shot */ - oc->flags &= ~CF_EXPECT_MORE; - sc->flags &= ~SC_FL_SND_ASAP; + sc->flags &= ~(SC_FL_SND_ASAP|SC_FL_SND_EXP_MORE); } /* if some data remain in the buffer, it's only because the * system buffers are full, we will try next time.