From: Christopher Faulet Date: Thu, 16 Mar 2023 14:53:28 +0000 (+0100) Subject: MINOR: stconn/channel: Move CF_SEND_DONTWAIT into the SC and rename it X-Git-Tag: v2.8-dev7~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c281d58ea53324a1f6e517bb53bad1efd4fce0c;p=thirdparty%2Fhaproxy.git MINOR: stconn/channel: Move CF_SEND_DONTWAIT into the SC and rename it The channel flag CF_SEND_DONTWAIT is renamed to SC_FL_SND_ASAP and moved into the stream-connector. --- diff --git a/include/haproxy/channel-t.h b/include/haproxy/channel-t.h index 0d54d8e4d8..f1788af5cb 100644 --- a/include/haproxy/channel-t.h +++ b/include/haproxy/channel-t.h @@ -111,7 +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) */ -#define CF_SEND_DONTWAIT 0x04000000 /* don't wait for sending data (one-shoot) */ +/* unused 0x04000000 */ #define CF_NEVER_WAIT 0x08000000 /* never wait for sending data (permanent) */ #define CF_WAKE_ONCE 0x10000000 /* pretend there is activity on this channel (one-shoot) */ @@ -142,8 +142,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_SEND_DONTWAIT, _(CF_NEVER_WAIT, _(CF_WAKE_ONCE, _(CF_FLT_ANALYZE, - _(CF_EOI, _(CF_ISRESP))))))))))))))))))))))); + _(CF_NEVER_WAIT, _(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 7dbb6550b9..a21ebe32b2 100644 --- a/include/haproxy/stconn-t.h +++ b/include/haproxy/stconn-t.h @@ -127,6 +127,7 @@ enum sc_flags { SC_FL_NEED_ROOM = 0x00000200, /* SC needs more room in the rx buffer to store incoming data */ 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 */ }; /* This function is used to report flags in debugging tools. Please reflect @@ -142,7 +143,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_RCV_ONCE, _(SC_FL_SND_ASAP)))))))))); /* epilogue */ _(~0U); return buf; diff --git a/src/http_ana.c b/src/http_ana.c index b8bad1e48d..cb6d6225b8 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -484,7 +484,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s req->analysers &= ~AN_REQ_FLT_XFER_DATA; req->analysers |= AN_REQ_HTTP_XFER_BODY; - req->flags |= CF_SEND_DONTWAIT; + s->scb->flags |= SC_FL_SND_ASAP; s->flags |= SF_ASSIGNED; goto done; } @@ -510,10 +510,10 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s * If this happens, then the data will not come immediately, so we must * send all what we have without waiting. Note that due to the small gain * in waiting for the body of the request, it's easier to simply put the - * CF_SEND_DONTWAIT flag any time. It's a one-shot flag so it will remove - * itself once used. + * SC_FL_SND_ASAP flag on the back SC any time. It's a one-shot flag so it + * will remove itself once used. */ - req->flags |= CF_SEND_DONTWAIT; + s->scb->flags |= SC_FL_SND_ASAP; done: /* done with this analyser, continue with next ones that the calling * points will have set, if any. @@ -1479,7 +1479,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit) msg->flags = 0; txn->status = 0; s->logs.t_data = -1; /* was not a response yet */ - rep->flags |= CF_SEND_DONTWAIT; /* Send ASAP informational messages */ + s->scf->flags |= SC_FL_SND_ASAP; /* Send ASAP informational messages */ goto next_one; } @@ -4456,7 +4456,7 @@ int http_forward_proxy_resp(struct stream *s, int final) /* Send ASAP informational messages. Rely on CF_EOI for final * response. */ - res->flags |= CF_SEND_DONTWAIT; + s->scf->flags |= SC_FL_SND_ASAP; } data = htx->data - co_data(res); diff --git a/src/stconn.c b/src/stconn.c index cca4a46983..edb3a661a8 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1591,7 +1591,8 @@ static int sc_conn_send(struct stconn *sc) */ unsigned int send_flag = 0; - if ((!(oc->flags & (CF_NEVER_WAIT|CF_SEND_DONTWAIT)) && + if ((!(sc->flags & SC_FL_SND_ASAP) && + !(oc->flags & CF_NEVER_WAIT) && ((oc->to_forward && oc->to_forward != CHN_INFINITE_FORWARD) || (oc->flags & CF_EXPECT_MORE) || (IS_HTX_STRM(s) && @@ -1637,7 +1638,8 @@ 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 | CF_SEND_DONTWAIT); + oc->flags &= ~CF_EXPECT_MORE; + sc->flags &= ~SC_FL_SND_ASAP; } /* if some data remain in the buffer, it's only because the * system buffers are full, we will try next time.