MINOR: mux-h2: stop relying on CS_FL_REOS

This flag was introduced early in 1.9 development (a3f7efe00) to report
the fact that the rxbuf that was present on the conn_stream was followed
by a shutr. Since then the rxbuf moved from the conn_stream to the h2s
(638b799b0) but the flag remained on the conn_stream. It is problematic
because some state transitions inside the mux depend on it, thus depend
on the CS, and as such have to test for its existence before proceeding.

This patch replaces the test on CS_FL_REOS with a test on the only
states that set this flag (H2_SS_CLOSED, H2_SS_HREM, H2_SS_ERROR).
The few places where the flag was set were removed (the flag is not
used by the data layer).
This commit is contained in:
Willy Tarreau 2019-05-14 11:46:28 +02:00
parent 4c688eb8d1
commit 99ad1b3e8c

View File

@ -864,7 +864,6 @@ static inline void h2s_close(struct h2s *h2s)
if (!h2s->id)
h2s->h2c->nb_reserved--;
if (h2s->cs) {
h2s->cs->flags |= CS_FL_REOS;
if (!(h2s->cs->flags & CS_FL_EOS) && !b_data(&h2s->rxbuf))
h2s_notify_recv(h2s);
}
@ -1432,7 +1431,7 @@ static int h2_send_empty_data_es(struct h2s *h2s)
}
/* wake a specific stream and assign its conn_stream som CS_FL_* flags among
* CS_FL_REOS, CS_FL_ERR_PENDING and CS_FL_ERROR if needed. The stream's state
* CS_FL_ERR_PENDING and CS_FL_ERROR if needed. The stream's state
* is automatically updated accordingly. If the stream is orphaned, it is
* destroyed.
*/
@ -1445,8 +1444,6 @@ static void h2s_wake_one_stream(struct h2s *h2s)
}
if (conn_xprt_read0_pending(h2s->h2c->conn)) {
h2s->cs->flags |= CS_FL_REOS;
if (h2s->st == H2_SS_OPEN)
h2s->st = H2_SS_HREM;
else if (h2s->st == H2_SS_HLOC)
@ -2323,7 +2320,8 @@ static void h2_process_demux(struct h2c *h2c)
if (tmp_h2s != h2s && h2s && h2s->cs &&
(b_data(&h2s->rxbuf) ||
(h2s->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS|CS_FL_REOS|CS_FL_EOI)))) {
(H2_SS_MASK(h2s->st) & H2_SS_EOS_BITS) ||
(h2s->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS|CS_FL_EOI)))) {
/* we may have to signal the upper layers */
h2s->cs->flags |= CS_FL_RCV_MORE;
h2s_notify_recv(h2s);
@ -2560,7 +2558,8 @@ static void h2_process_demux(struct h2c *h2c)
/* we can go here on missing data, blocked response or error */
if (h2s && h2s->cs &&
(b_data(&h2s->rxbuf) ||
(h2s->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS|CS_FL_REOS|CS_FL_EOI)))) {
(H2_SS_MASK(h2s->st) & H2_SS_EOS_BITS) ||
(h2s->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS|CS_FL_EOI)))) {
/* we may have to signal the upper layers */
h2s->cs->flags |= CS_FL_RCV_MORE;
h2s_notify_recv(h2s);
@ -5316,7 +5315,7 @@ static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
cs->flags |= (CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
else {
cs->flags &= ~(CS_FL_RCV_MORE | CS_FL_WANT_ROOM);
if (cs->flags & CS_FL_REOS)
if (H2_SS_MASK(h2s->st) & H2_SS_EOS_BITS)
cs->flags |= CS_FL_EOS;
if (cs->flags & CS_FL_ERR_PENDING)
cs->flags |= CS_FL_ERROR;