MINOR: stconn: rename SE_FL_RXBLK_CONN to SE_FL_APPLET_NEED_CONN

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.
This commit is contained in:
Willy Tarreau 2022-05-24 16:49:03 +02:00
parent 676c8db134
commit b23edc8b8d
7 changed files with 15 additions and 17 deletions

View 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_CHAN);
SHOW_FLAG(f, SE_FL_RXBLK_BUFF); SHOW_FLAG(f, SE_FL_RXBLK_BUFF);
SHOW_FLAG(f, SE_FL_RXBLK_ROOM); 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_RX_WAIT_EP);
SHOW_FLAG(f, SE_FL_WANT_GET); SHOW_FLAG(f, SE_FL_WANT_GET);
SHOW_FLAG(f, SE_FL_WAIT_DATA); SHOW_FLAG(f, SE_FL_WAIT_DATA);

View File

@ -79,7 +79,7 @@ enum se_flags {
SE_FL_RXBLK_BUFF = 0x08000000, /* CS waits for a buffer allocation to complete */ 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 */ SE_FL_RXBLK_ROOM = 0x10000000, /* CS waits for more buffer room to store incoming data */
/* unused 0x20000000,*/ /* 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_RXBLK_ANY = 0x5C000000, /* any of the RXBLK flags above */
SE_FL_APP_MASK = 0x5fe00000, /* Mask for flags set by the app layer */ SE_FL_APP_MASK = 0x5fe00000, /* Mask for flags set by the app layer */
}; };

View File

@ -328,16 +328,14 @@ static inline void cs_rx_chan_blk(struct stconn *cs)
sc_ep_set(cs, SE_FL_RXBLK_CHAN); sc_ep_set(cs, SE_FL_RXBLK_CHAN);
} }
/* Tell a stream connector the other side is connected */ /* An frontend (applet) stream endpoint tells the connector it needs the other
static inline void cs_rx_conn_rdy(struct stconn *cs) * 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_clr(cs, SE_FL_RXBLK_CONN); se_fl_set(se, SE_FL_APPLET_NEED_CONN);
}
/* Tell a stream connector it must wait for the other side to connect */
static inline void cs_rx_conn_blk(struct stconn *cs)
{
sc_ep_set(cs, SE_FL_RXBLK_CONN);
} }
/* The stream connector just got the input buffer it was waiting for */ /* The stream connector just got the input buffer it was waiting for */

View File

@ -296,8 +296,8 @@ static inline void cs_chk_rcv(struct stconn *cs)
{ {
struct channel *ic = sc_ic(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)) 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))
cs_rx_conn_rdy(cs); sc_ep_clr(cs, SE_FL_APPLET_NEED_CONN);
if (ic->flags & CF_SHUTR) if (ic->flags & CF_SHUTR)
return; return;

View File

@ -473,7 +473,7 @@ static void dns_session_io_handler(struct appctx *appctx)
*/ */
if (cs_opposite(cs)->state < SC_ST_EST) { if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs); cs_cant_get(cs);
cs_rx_conn_blk(cs); se_need_remote_conn(appctx->sedesc);
cs_rx_endp_more(cs); cs_rx_endp_more(cs);
return; return;
} }

View File

@ -1957,7 +1957,7 @@ static void hlua_socket_handler(struct appctx *appctx)
*/ */
if (cs_opposite(cs)->state < SC_ST_EST) { if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs); cs_cant_get(cs);
cs_rx_conn_blk(cs); se_need_remote_conn(appctx->sedesc);
cs_rx_endp_more(cs); cs_rx_endp_more(cs);
return; return;
} }

View File

@ -334,7 +334,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
*/ */
if (cs_opposite(cs)->state < SC_ST_EST) { if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs); cs_cant_get(cs);
cs_rx_conn_blk(cs); se_need_remote_conn(appctx->sedesc);
cs_rx_endp_more(cs); cs_rx_endp_more(cs);
return; return;
} }
@ -474,7 +474,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
*/ */
if (cs_opposite(cs)->state < SC_ST_EST) { if (cs_opposite(cs)->state < SC_ST_EST) {
cs_cant_get(cs); cs_cant_get(cs);
cs_rx_conn_blk(cs); se_need_remote_conn(appctx->sedesc);
cs_rx_endp_more(cs); cs_rx_endp_more(cs);
return; return;
} }