]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn/channel: Move CF_EXPECT_MORE into the SC and rename it
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 17 Mar 2023 14:45:58 +0000 (15:45 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:57:05 +0000 (08:57 +0200)
The channel flag CF_EXPECT_MORE is renamed to SC_FL_SND_EXP_MORE and moved
into the stream-connector.

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

index 69db465cc450b56de173bc73e57827b154066108..a69ce46cd2064f9438aece6be5ed345e9f7daf4d 100644 (file)
 #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;
index 4ac2237cacc482aa5a1b9039f255cd5906e41445..285b35c29d81cd1e657cee7548a100788d76f9bb 100644 (file)
@@ -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;
index ff3f3a366f2db3941f932c428e29c03b032321a9..ae97b33c170614b695f4b738e765e4383f0ef813 100644 (file)
@@ -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",
index 3f607d3d8345f5f300466d087aca46c73d723fa7..134af8f42034ab220c65464faf77df55b2a2d692 100644 (file)
@@ -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.