mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-29 14:01:50 +01:00
MEDIUM: stream-int: use si_rx_shut_blk() to indicate the SI is closed
Till now we were using si_done_put() upon shutr, but these flags could be reset upon next activity. Now let's switch to SI_FL_RXBLK_SHUT which doesn't go away. It's also set in stream_int_update() in case a shutr condition is detected. The now unused si_done_put() was removed.
This commit is contained in:
parent
4b962a4179
commit
abb5d4202f
@ -266,13 +266,6 @@ static inline void si_cant_put(struct stream_interface *si)
|
||||
si->flags &= ~SI_FL_RX_WAIT_EP;
|
||||
}
|
||||
|
||||
/* Report that a stream interface won't put any more data into the input buffer */
|
||||
static inline void si_done_put(struct stream_interface *si)
|
||||
{
|
||||
si->flags &= ~SI_FL_RXBLK_ROOM;
|
||||
si->flags |= SI_FL_RX_WAIT_EP;
|
||||
}
|
||||
|
||||
/* The stream interface announces it is ready to try to deliver more data to the input buffer */
|
||||
static inline void si_rx_endp_more(struct stream_interface *si)
|
||||
{
|
||||
@ -301,6 +294,15 @@ static inline void si_rx_buff_blk(struct stream_interface *si)
|
||||
si->flags |= SI_FL_RXBLK_BUFF;
|
||||
}
|
||||
|
||||
/* The stream interface announces it will never put new data into the input
|
||||
* buffer and that it's not waiting for its endpoint to deliver anything else.
|
||||
* This function obviously doesn't have a _rdy equivalent.
|
||||
*/
|
||||
static inline void si_rx_shut_blk(struct stream_interface *si)
|
||||
{
|
||||
si->flags |= SI_FL_RXBLK_SHUT;
|
||||
}
|
||||
|
||||
/* Returns non-zero if the stream interface's Rx path is blocked */
|
||||
static inline int si_tx_blocked(const struct stream_interface *si)
|
||||
{
|
||||
|
||||
@ -157,12 +157,12 @@ static void stream_int_shutr(struct stream_interface *si)
|
||||
{
|
||||
struct channel *ic = si_ic(si);
|
||||
|
||||
si_rx_shut_blk(si);
|
||||
ic->flags &= ~CF_SHUTR_NOW;
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
si_done_put(si);
|
||||
|
||||
if (si->state != SI_ST_EST && si->state != SI_ST_CON)
|
||||
return;
|
||||
@ -225,8 +225,8 @@ static void stream_int_shutw(struct stream_interface *si)
|
||||
/* Note that none of these states may happen with applets */
|
||||
si->state = SI_ST_DIS;
|
||||
default:
|
||||
si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_NOLINGER);
|
||||
si->flags |= SI_FL_RX_WAIT_EP;
|
||||
si->flags &= ~SI_FL_NOLINGER;
|
||||
si_rx_shut_blk(si);
|
||||
ic->flags &= ~CF_SHUTR_NOW;
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
@ -767,6 +767,8 @@ void stream_int_update(struct stream_interface *si)
|
||||
ic->rex = tick_add_ifset(now_ms, ic->rto);
|
||||
}
|
||||
}
|
||||
else
|
||||
si_rx_shut_blk(si);
|
||||
|
||||
if (!(oc->flags & CF_SHUTW)) {
|
||||
/* Write not closed, update FD status and timeout for writes */
|
||||
@ -886,12 +888,12 @@ static void stream_int_shutr_conn(struct stream_interface *si)
|
||||
struct conn_stream *cs = __objt_cs(si->end);
|
||||
struct channel *ic = si_ic(si);
|
||||
|
||||
si_rx_shut_blk(si);
|
||||
ic->flags &= ~CF_SHUTR_NOW;
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
si_done_put(si);
|
||||
|
||||
if (si->state != SI_ST_EST && si->state != SI_ST_CON)
|
||||
return;
|
||||
@ -984,8 +986,8 @@ static void stream_int_shutw_conn(struct stream_interface *si)
|
||||
si->state = SI_ST_DIS;
|
||||
/* fall through */
|
||||
default:
|
||||
si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_NOLINGER);
|
||||
si->flags |= SI_FL_RX_WAIT_EP;
|
||||
si->flags &= ~SI_FL_NOLINGER;
|
||||
si_rx_shut_blk(si);
|
||||
ic->flags &= ~CF_SHUTR_NOW;
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
@ -1369,12 +1371,12 @@ void stream_sock_read0(struct stream_interface *si)
|
||||
struct channel *ic = si_ic(si);
|
||||
struct channel *oc = si_oc(si);
|
||||
|
||||
si_rx_shut_blk(si);
|
||||
ic->flags &= ~CF_SHUTR_NOW;
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
si_done_put(si);
|
||||
|
||||
if (si->state != SI_ST_EST && si->state != SI_ST_CON)
|
||||
return;
|
||||
@ -1454,12 +1456,12 @@ static void stream_int_shutr_applet(struct stream_interface *si)
|
||||
{
|
||||
struct channel *ic = si_ic(si);
|
||||
|
||||
si_rx_shut_blk(si);
|
||||
ic->flags &= ~CF_SHUTR_NOW;
|
||||
if (ic->flags & CF_SHUTR)
|
||||
return;
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
si_done_put(si);
|
||||
|
||||
/* Note: on shutr, we don't call the applet */
|
||||
|
||||
@ -1525,8 +1527,8 @@ static void stream_int_shutw_applet(struct stream_interface *si)
|
||||
si_applet_release(si);
|
||||
si->state = SI_ST_DIS;
|
||||
default:
|
||||
si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_NOLINGER);
|
||||
si->flags |= SI_FL_RX_WAIT_EP;
|
||||
si->flags &= ~SI_FL_NOLINGER;
|
||||
si_rx_shut_blk(si);
|
||||
ic->flags &= ~CF_SHUTR_NOW;
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user