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

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

index 0d54d8e4d85018b28614055d9b108cca01cac21b..f1788af5cbd8a6f8cc13bed8c4dd51eb144cf1a4 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) */
-#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;
index 7dbb6550b97238f06d07b9b3793151c843aef65f..a21ebe32b2507db2730fc6edac5aa594168c4200 100644 (file)
@@ -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;
index b8bad1e48de0424033f61439680fb0594f5d1894..cb6d6225b8827b256a329302cf5ac02dd500dd8a 100644 (file)
@@ -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);
index cca4a46983227220a74ebf2458e32fdb5a469683..edb3a661a82a6f68dc9bb25fdd9dce690543a6d9 100644 (file)
@@ -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.