MINOR: stconn/channel: Move CF_NEVER_WAIT into the SC and rename it
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 17 Mar 2023 14:38:18 +0000 (15:38 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:57:05 +0000 (08:57 +0200)
The channel flag CF_NEVER_WAIT is renamed to SC_FL_SND_NEVERWAIT and moved
into the stream-connector.

include/haproxy/channel-t.h
include/haproxy/stconn-t.h
src/cli.c
src/http_ana.c
src/proxy.c
src/stconn.c
src/stream.c

index f1788af..69db465 100644 (file)
 
 #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;
index a21ebe3..4ac2237 100644 (file)
@@ -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;
index 74d13f2..32b1c2c 100644 (file)
--- 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 */
index cb6d622..ff3f3a3 100644 (file)
@@ -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;
        }
index cb3d474..f08ec93 100644 (file)
@@ -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;
index edb3a66..3f607d3 100644 (file)
@@ -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) &&
index 8097af2..5794fd9 100644 (file)
@@ -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;