]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
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 f1788af5cbd8a6f8cc13bed8c4dd51eb144cf1a4..69db465cc450b56de173bc73e57827b154066108 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 a21ebe32b2507db2730fc6edac5aa594168c4200..4ac2237cacc482aa5a1b9039f255cd5906e41445 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 74d13f2e93524a0deb324985c95188eb2c5e1745..32b1c2c0199ffb80aa83baf553220def9f3a9709 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 cb6d6225b8827b256a329302cf5ac02dd500dd8a..ff3f3a366f2db3941f932c428e29c03b032321a9 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 cb3d474dc748c34416756f567b74d8827ee9ee63..f08ec93d83c04f83709e8d6a0d9640d8bbcacf37 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 edb3a661a82a6f68dc9bb25fdd9dce690543a6d9..3f607d3d8345f5f300466d087aca46c73d723fa7 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 8097af26345cb6aac8288dffc15905ec447c7588..5794fd913f2b9604f9c577550b33fbffa5458a0e 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;