]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn: rename SE_FL_RXBLK_CONN to SE_FL_APPLET_NEED_CONN
authorWilly Tarreau <w@1wt.eu>
Tue, 24 May 2022 14:49:03 +0000 (16:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
This flag is exclusively used when a front applet needs to wait for the
other side to connect (or fail to). Let's give it a more explicit name
and remove the ambiguous function that was used only once.

This also ensures we will not risk to set it back on a new endpoint
after cs_reset_endp() via SE_FL_APP_MASK, because the flag being
specific to the endpoint only and not to the connector, we don't
want to preserve it when replacing the endpoint.

dev/flags/flags.c
include/haproxy/conn_stream-t.h
include/haproxy/conn_stream.h
include/haproxy/cs_utils.h
src/dns.c
src/hlua.c
src/sink.c

index 5ce76e6b0ca26b678cb7cca929f73cac14428b36..71a1874e0576c643de04a9c19527bcd5a697b5f2 100644 (file)
@@ -187,7 +187,7 @@ void show_endp_flags(unsigned int f)
        SHOW_FLAG(f, SE_FL_RXBLK_CHAN);
        SHOW_FLAG(f, SE_FL_RXBLK_BUFF);
        SHOW_FLAG(f, SE_FL_RXBLK_ROOM);
-       SHOW_FLAG(f, SE_FL_RXBLK_CONN);
+       SHOW_FLAG(f, SE_FL_APPLET_NEED_CONN);
        SHOW_FLAG(f, SE_FL_RX_WAIT_EP);
        SHOW_FLAG(f, SE_FL_WANT_GET);
        SHOW_FLAG(f, SE_FL_WAIT_DATA);
index a29a18e28754292741905ec04f09ed0b1564c316..599ee81de8af755ee588a921321e2210a560b352 100644 (file)
@@ -79,7 +79,7 @@ enum se_flags {
        SE_FL_RXBLK_BUFF    = 0x08000000,  /* CS waits for a buffer allocation to complete */
        SE_FL_RXBLK_ROOM    = 0x10000000,  /* CS waits for more buffer room to store incoming data */
        /* unused             0x20000000,*/
-       SE_FL_RXBLK_CONN    = 0x40000000,  /* other side is not connected */
+       SE_FL_APPLET_NEED_CONN = 0x40000000,  /* applet is waiting for the other side to (fail to) connect */
        SE_FL_RXBLK_ANY     = 0x5C000000,  /* any of the RXBLK flags above */
        SE_FL_APP_MASK      = 0x5fe00000,  /* Mask for flags set by the app layer */
 };
index 643d2bf99b0dafc8908ca600932ecfd9875f2815..490eecf1a8384daedcd7bd1d39fb0f9780bcf4d5 100644 (file)
@@ -328,16 +328,14 @@ static inline void cs_rx_chan_blk(struct stconn *cs)
        sc_ep_set(cs, SE_FL_RXBLK_CHAN);
 }
 
-/* Tell a stream connector the other side is connected */
-static inline void cs_rx_conn_rdy(struct stconn *cs)
-{
-       sc_ep_clr(cs, SE_FL_RXBLK_CONN);
-}
-
-/* Tell a stream connector it must wait for the other side to connect */
-static inline void cs_rx_conn_blk(struct stconn *cs)
+/* An frontend (applet) stream endpoint tells the connector it needs the other
+ * side to connect or fail before continuing to work. This is used for example
+ * to allow an applet not to deliver data to a request channel before a
+ * connection is confirmed.
+ */
+static inline void se_need_remote_conn(struct sedesc *se)
 {
-       sc_ep_set(cs, SE_FL_RXBLK_CONN);
+       se_fl_set(se, SE_FL_APPLET_NEED_CONN);
 }
 
 /* The stream connector just got the input buffer it was waiting for */
index a26011be3187f99b1198c1b74fad432e7fbf11f6..9aceb9c52aa5099caf7bf7cc0e4d65140a4cea9d 100644 (file)
@@ -296,8 +296,8 @@ static inline void cs_chk_rcv(struct stconn *cs)
 {
        struct channel *ic = sc_ic(cs);
 
-       if (sc_ep_test(cs, SE_FL_RXBLK_CONN) && cs_state_in(cs_opposite(cs)->state, SC_SB_RDY|SC_SB_EST|SC_SB_DIS|SC_SB_CLO))
-               cs_rx_conn_rdy(cs);
+       if (sc_ep_test(cs, SE_FL_APPLET_NEED_CONN) && cs_state_in(cs_opposite(cs)->state, SC_SB_RDY|SC_SB_EST|SC_SB_DIS|SC_SB_CLO))
+               sc_ep_clr(cs, SE_FL_APPLET_NEED_CONN);
 
        if (ic->flags & CF_SHUTR)
                return;
index 422351b717e22baff8c3a263196814001b53570b..6156dbad6aa40da14bb103eff3e0881ba9c68919 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -473,7 +473,7 @@ static void dns_session_io_handler(struct appctx *appctx)
         */
        if (cs_opposite(cs)->state < SC_ST_EST) {
                cs_cant_get(cs);
-               cs_rx_conn_blk(cs);
+               se_need_remote_conn(appctx->sedesc);
                cs_rx_endp_more(cs);
                return;
        }
index 4fc952c39c5b5d0287abe40b46bfc300301e3926..26017555c04caf44f4e18e555173c9dbac003003 100644 (file)
@@ -1957,7 +1957,7 @@ static void hlua_socket_handler(struct appctx *appctx)
         */
        if (cs_opposite(cs)->state < SC_ST_EST) {
                cs_cant_get(cs);
-               cs_rx_conn_blk(cs);
+               se_need_remote_conn(appctx->sedesc);
                cs_rx_endp_more(cs);
                return;
        }
index 831c5b444d90af68ce48c7155e5dad80e60caf60..6bd30fcac30683f84f429c250f5ebdd1fcdf8f52 100644 (file)
@@ -334,7 +334,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
         */
        if (cs_opposite(cs)->state < SC_ST_EST) {
                cs_cant_get(cs);
-               cs_rx_conn_blk(cs);
+               se_need_remote_conn(appctx->sedesc);
                cs_rx_endp_more(cs);
                return;
        }
@@ -474,7 +474,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
         */
        if (cs_opposite(cs)->state < SC_ST_EST) {
                cs_cant_get(cs);
-               cs_rx_conn_blk(cs);
+               se_need_remote_conn(appctx->sedesc);
                cs_rx_endp_more(cs);
                return;
        }