From: Christopher Faulet Date: Fri, 17 Mar 2023 14:38:18 +0000 (+0100) Subject: MINOR: stconn/channel: Move CF_NEVER_WAIT into the SC and rename it X-Git-Tag: v2.8-dev7~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=68ef218a72ccd2ebc65c6a990c50ac40a19dec70;p=thirdparty%2Fhaproxy.git MINOR: stconn/channel: Move CF_NEVER_WAIT into the SC and rename it The channel flag CF_NEVER_WAIT is renamed to SC_FL_SND_NEVERWAIT and moved into the stream-connector. --- diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index f1788af5cb..69db465cc4 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -111,8 +111,7 @@ #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 */ -#define CF_NEVER_WAIT 0x08000000 /* never wait for sending data (permanent) */ +/* unused 0x04000000 - 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 */ @@ -142,8 +141,8 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim _(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA, _(CF_KERN_SPLICING, _(CF_AUTO_CONNECT, _(CF_DONT_READ, _(CF_EXPECT_MORE, - _(CF_NEVER_WAIT, _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE, - _(CF_EOI, _(CF_ISRESP)))))))))))))))))))))); + _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE, + _(CF_EOI, _(CF_ISRESP))))))))))))))))))))); /* epilogue */ _(~0U); return buf; diff --git a/include/haproxy/stconn-t.h b/include/haproxy/stconn-t.h index a21ebe32b2..4ac2237cac 100644 --- a/include/haproxy/stconn-t.h +++ b/include/haproxy/stconn-t.h @@ -128,6 +128,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) */ }; /* This function is used to report flags in debugging tools. Please reflect @@ -143,7 +144,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_RCV_ONCE, _(SC_FL_SND_ASAP, _(SC_FL_SND_NEVERWAIT))))))))))); /* epilogue */ _(~0U); return buf; diff --git a/src/cli.c b/src/cli.c index 74d13f2e93..32b1c2c019 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2739,7 +2739,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) return 0; } s->scb->flags |= SC_FL_RCV_ONCE; /* try to get back here ASAP */ - rep->flags |= CF_NEVER_WAIT; + s->scf->flags |= SC_FL_SND_NEVERWAIT; /* don't forward the close */ channel_dont_close(&s->res); @@ -2847,8 +2847,8 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) sc_set_state(s->scb, SC_ST_INI); s->scb->flags &= SC_FL_ISBACK | SC_FL_DONT_WAKE; /* we're in the context of process_stream */ - s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WROTE_DATA); - s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_EVENT|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_EVENT); + s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_STREAMER|CF_STREAMER_FAST|CF_WROTE_DATA); + s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_EVENT|CF_WROTE_DATA|CF_READ_EVENT); s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST); s->flags &= ~(SF_CURR_SESS|SF_REDIRECTABLE|SF_SRV_REUSED); s->flags &= ~(SF_ERR_MASK|SF_FINST_MASK|SF_REDISP); @@ -2869,6 +2869,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) s->store_count = 0; s->uniq_id = global.req_count++; + s->scf->flags &= ~SC_FL_SND_NEVERWAIT; s->scf->flags |= SC_FL_RCV_ONCE; /* one read is usually enough */ s->req.flags |= CF_WAKE_ONCE; /* need to be called again if there is some command left in the request */ diff --git a/src/http_ana.c b/src/http_ana.c index cb6d6225b8..ff3f3a366f 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -4233,7 +4233,7 @@ static void http_end_request(struct stream *s) * to shut this side, and 2) the server is waiting for us to * send pending data. */ - chn->flags |= CF_NEVER_WAIT; + s->scb->flags |= SC_FL_SND_NEVERWAIT; if (txn->rsp.msg_state < HTTP_MSG_BODY || (txn->rsp.msg_state < HTTP_MSG_DONE && s->scb->state != SC_ST_CLO)) { @@ -4313,7 +4313,7 @@ static void http_end_request(struct stream *s) end: chn->analysers &= AN_REQ_FLT_END; if (txn->req.msg_state == HTTP_MSG_TUNNEL) { - chn->flags |= CF_NEVER_WAIT; + s->scb->flags |= SC_FL_SND_NEVERWAIT; if (HAS_REQ_DATA_FILTERS(s)) chn->analysers |= AN_REQ_FLT_XFER_DATA; } @@ -4409,7 +4409,7 @@ static void http_end_response(struct stream *s) end: chn->analysers &= AN_RES_FLT_END; if (txn->rsp.msg_state == HTTP_MSG_TUNNEL) { - chn->flags |= CF_NEVER_WAIT; + s->scf->flags |= SC_FL_SND_NEVERWAIT; if (HAS_RSP_DATA_FILTERS(s)) chn->analysers |= AN_RES_FLT_XFER_DATA; } diff --git a/src/proxy.c b/src/proxy.c index cb3d474dc7..f08ec93d83 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -2473,8 +2473,8 @@ int stream_set_backend(struct stream *s, struct proxy *be) s->flags |= SF_BE_ASSIGNED; if (be->options2 & PR_O2_NODELAY) { - s->req.flags |= CF_NEVER_WAIT; - s->res.flags |= CF_NEVER_WAIT; + s->scf->flags |= SC_FL_SND_NEVERWAIT; + s->scb->flags |= SC_FL_SND_NEVERWAIT; } return 1; diff --git a/src/stconn.c b/src/stconn.c index edb3a661a8..3f607d3d83 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1591,8 +1591,7 @@ static int sc_conn_send(struct stconn *sc) */ unsigned int send_flag = 0; - if ((!(sc->flags & SC_FL_SND_ASAP) && - !(oc->flags & CF_NEVER_WAIT) && + 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) || (IS_HTX_STRM(s) && diff --git a/src/stream.c b/src/stream.c index 8097af2634..5794fd913f 100644 --- a/src/stream.c +++ b/src/stream.c @@ -529,8 +529,8 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer s->res.analysers = 0; if (sess->fe->options2 & PR_O2_NODELAY) { - s->req.flags |= CF_NEVER_WAIT; - s->res.flags |= CF_NEVER_WAIT; + s->scf->flags |= SC_FL_SND_NEVERWAIT; + s->scb->flags |= SC_FL_SND_NEVERWAIT; } s->scb->ioto = TICK_ETERNITY;