MEDIUM: stconn: take SE_FL_APPLET_NEED_CONN out of the RXBLK_ANY flags
This makes SE_FL_APPLET_NEED_CONN autonomous, in that we check for it everywhere we have a relevant cs_rx_blocked(), so that the flag doesn't need anymore to be covered by cs_rx_blocked(). Indeed, this flag doesn't really translate a receive blocking condition but rather a refusal to wake up an applet that is waiting for a connection to finish to setup. 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. It's possible that cs_chk_rcv() could later be further simplified if we can demonstrate that the two tests in it can be merged.
This commit is contained in:
parent
b23edc8b8d
commit
b73262fc85
@ -78,10 +78,10 @@ enum se_flags {
|
||||
SE_FL_RXBLK_CHAN = 0x04000000, /* the channel doesn't want the CS to introduce data */
|
||||
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_ANY = 0x1C000000, /* any of the RXBLK flags above */
|
||||
SE_FL_APP_MASK = 0x1fe00000, /* Mask for flags set by the app layer */
|
||||
/* unused 0x20000000,*/
|
||||
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 */
|
||||
};
|
||||
|
||||
/* stconn flags */
|
||||
|
@ -296,13 +296,15 @@ static inline void cs_chk_rcv(struct stconn *cs)
|
||||
{
|
||||
struct channel *ic = sc_ic(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))
|
||||
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;
|
||||
|
||||
if (cs_rx_blocked(cs) || !cs_rx_endp_ready(cs))
|
||||
if (sc_ep_test(cs, SE_FL_APPLET_NEED_CONN) ||
|
||||
cs_rx_blocked(cs) || !cs_rx_endp_ready(cs))
|
||||
return;
|
||||
|
||||
if (!cs_state_in(cs->state, SC_SB_RDY|SC_SB_EST))
|
||||
|
@ -1178,7 +1178,7 @@ static void cs_notify(struct stconn *cs)
|
||||
cs_chk_rcv(cs);
|
||||
cs_chk_rcv(cso);
|
||||
|
||||
if (ic->flags & CF_SHUTR || cs_rx_blocked(cs)) {
|
||||
if (ic->flags & CF_SHUTR || sc_ep_test(cs, SE_FL_APPLET_NEED_CONN) || cs_rx_blocked(cs)) {
|
||||
ic->rex = TICK_ETERNITY;
|
||||
}
|
||||
else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL)) == CF_READ_PARTIAL) {
|
||||
@ -1925,7 +1925,7 @@ static int cs_applet_process(struct stconn *cs)
|
||||
/* automatically mark the applet having data available if it reported
|
||||
* begin blocked by the channel.
|
||||
*/
|
||||
if (cs_rx_blocked(cs))
|
||||
if (cs_rx_blocked(cs) || sc_ep_test(cs, SE_FL_APPLET_NEED_CONN))
|
||||
cs_rx_endp_more(cs);
|
||||
|
||||
/* update the stream connector, channels, and possibly wake the stream up */
|
||||
@ -1937,7 +1937,8 @@ static int cs_applet_process(struct stconn *cs)
|
||||
* appctx but in the case the task is not in runqueue we may have to
|
||||
* wakeup the appctx immediately.
|
||||
*/
|
||||
if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs) && !(ic->flags & CF_SHUTR)) ||
|
||||
if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs) &&
|
||||
!sc_ep_test(cs, SE_FL_APPLET_NEED_CONN) && !(ic->flags & CF_SHUTR)) ||
|
||||
sc_is_send_allowed(cs))
|
||||
appctx_wakeup(__sc_appctx(cs));
|
||||
return 0;
|
||||
|
@ -1543,11 +1543,13 @@ static void stream_update_both_cs(struct stream *s)
|
||||
* handled at the latest moment.
|
||||
*/
|
||||
if (sc_appctx(scf)) {
|
||||
if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf) && !(req->flags & CF_SHUTR)) || sc_is_send_allowed(scf))
|
||||
if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf) && !sc_ep_test(scf, SE_FL_APPLET_NEED_CONN) &&
|
||||
!(req->flags & CF_SHUTR)) || sc_is_send_allowed(scf))
|
||||
appctx_wakeup(__sc_appctx(scf));
|
||||
}
|
||||
if (sc_appctx(scb)) {
|
||||
if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb) && !(res->flags & CF_SHUTR)) || sc_is_send_allowed(scb))
|
||||
if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb) && !sc_ep_test(scb, SE_FL_APPLET_NEED_CONN) &&
|
||||
!(res->flags & CF_SHUTR)) || sc_is_send_allowed(scb))
|
||||
appctx_wakeup(__sc_appctx(scb));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user