mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-17 20:45:40 +00:00
CLEANUP: h2: rename misleading h2c_stream_close() to h2s_close()
This function takes an h2c and an h2s but it never uses the h2c, which is a bit confusing at some places in the code. Let's make it clear that it only operates on the h2s instead by renaming it and removing the unused h2c argument.
This commit is contained in:
parent
2788a39c07
commit
00dd07895a
37
src/mux_h2.c
37
src/mux_h2.c
@ -631,12 +631,11 @@ static inline __maybe_unused int h2_get_frame_hdr(struct buffer *b, struct h2_fh
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* marks stream <h2s> as CLOSED for connection <h2c> and decrement the number
|
||||
* of active streams for this connection if the stream was not yet closed.
|
||||
* Please use this exclusively before closing a stream to ensure stream count
|
||||
* is well maintained.
|
||||
/* marks stream <h2s> as CLOSED and decrement the number of active streams for
|
||||
* its connection if the stream was not yet closed. Please use this exclusively
|
||||
* before closing a stream to ensure stream count is well maintained.
|
||||
*/
|
||||
static inline void h2c_stream_close(struct h2c *h2c, struct h2s *h2s)
|
||||
static inline void h2s_close(struct h2s *h2s)
|
||||
{
|
||||
if (h2s->st != H2_SS_CLOSED)
|
||||
h2s->h2c->nb_streams--;
|
||||
@ -916,7 +915,7 @@ static int h2s_send_rst_stream(struct h2c *h2c, struct h2s *h2s)
|
||||
}
|
||||
|
||||
h2s->flags |= H2_SF_RST_SENT;
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -971,7 +970,7 @@ static int h2c_send_rst_stream(struct h2c *h2c, struct h2s *h2s)
|
||||
|
||||
if (h2s->st > H2_SS_IDLE && h2s->st < H2_SS_CLOSED) {
|
||||
h2s->flags |= H2_SF_RST_SENT;
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1049,7 +1048,7 @@ static void h2_wake_some_streams(struct h2c *h2c, int last, uint32_t flags)
|
||||
|
||||
if (!h2s->cs) {
|
||||
/* this stream was already orphaned */
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
eb32_delete(&h2s->by_id);
|
||||
pool_free(pool_head_h2s, h2s);
|
||||
continue;
|
||||
@ -1067,7 +1066,7 @@ static void h2_wake_some_streams(struct h2c *h2c, int last, uint32_t flags)
|
||||
else if (flags & CS_FL_EOS && h2s->st == H2_SS_OPEN)
|
||||
h2s->st = H2_SS_HREM;
|
||||
else if (flags & CS_FL_EOS && h2s->st == H2_SS_HLOC)
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1534,7 +1533,7 @@ static int h2c_handle_rst_stream(struct h2c *h2c, struct h2s *h2s)
|
||||
return 1;
|
||||
|
||||
h2s->errcode = h2_get_n32(h2c->dbuf, 0);
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
|
||||
if (h2s->cs) {
|
||||
h2s->cs->flags |= CS_FL_EOS | CS_FL_ERROR;
|
||||
@ -2082,7 +2081,7 @@ static int h2_process_mux(struct h2c *h2c)
|
||||
h2s->cs->flags &= ~CS_FL_DATA_WR_ENA;
|
||||
else {
|
||||
/* just sent the last frame for this orphaned stream */
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
eb32_delete(&h2s->by_id);
|
||||
pool_free(pool_head_h2s, h2s);
|
||||
}
|
||||
@ -2125,7 +2124,7 @@ static int h2_process_mux(struct h2c *h2c)
|
||||
h2s->cs->flags &= ~CS_FL_DATA_WR_ENA;
|
||||
else {
|
||||
/* just sent the last frame for this orphaned stream */
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
eb32_delete(&h2s->by_id);
|
||||
pool_free(pool_head_h2s, h2s);
|
||||
}
|
||||
@ -2495,7 +2494,7 @@ static void h2_detach(struct conn_stream *cs)
|
||||
|
||||
if (h2s->by_id.node.leaf_p) {
|
||||
/* h2s still attached to the h2c */
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
eb32_delete(&h2s->by_id);
|
||||
|
||||
/* We don't want to close right now unless we're removing the
|
||||
@ -2551,7 +2550,7 @@ static void h2_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
|
||||
if (h2s->h2c->mbuf->o && !(cs->conn->flags & CO_FL_XPRT_WR_ENA))
|
||||
conn_xprt_want_send(cs->conn);
|
||||
|
||||
h2c_stream_close(h2s->h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
}
|
||||
|
||||
static void h2_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
|
||||
@ -2569,7 +2568,7 @@ static void h2_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
|
||||
return;
|
||||
|
||||
if (h2s->st == H2_SS_HREM)
|
||||
h2c_stream_close(h2s->h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
else
|
||||
h2s->st = H2_SS_HLOC;
|
||||
} else {
|
||||
@ -2587,7 +2586,7 @@ static void h2_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
|
||||
h2c_send_goaway_error(h2s->h2c, h2s) <= 0)
|
||||
return;
|
||||
|
||||
h2c_stream_close(h2s->h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
}
|
||||
|
||||
if (h2s->h2c->mbuf->o && !(cs->conn->flags & CO_FL_XPRT_WR_ENA))
|
||||
@ -3038,7 +3037,7 @@ static int h2s_frt_make_resp_headers(struct h2s *h2s, struct buffer *buf)
|
||||
if (h2s->st == H2_SS_OPEN)
|
||||
h2s->st = H2_SS_HLOC;
|
||||
else
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
}
|
||||
else if (h1m->status >= 100 && h1m->status < 200) {
|
||||
/* we'll let the caller check if it has more headers to send */
|
||||
@ -3280,7 +3279,7 @@ static int h2s_frt_make_resp_data(struct h2s *h2s, struct buffer *buf)
|
||||
if (h2s->st == H2_SS_OPEN)
|
||||
h2s->st = H2_SS_HLOC;
|
||||
else
|
||||
h2c_stream_close(h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
|
||||
if (!(h1m->flags & H1_MF_CHNK)) {
|
||||
// trim any possibly pending data (eg: inconsistent content-length)
|
||||
@ -3353,7 +3352,7 @@ static int h2_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
|
||||
if (h2s->st == H2_SS_ERROR || h2s->flags & H2_SF_RST_RCVD) {
|
||||
cs->flags |= CS_FL_ERROR;
|
||||
if (h2s_send_rst_stream(h2s->h2c, h2s) > 0)
|
||||
h2c_stream_close(h2s->h2c, h2s);
|
||||
h2s_close(h2s);
|
||||
}
|
||||
|
||||
if (h2s->flags & H2_SF_BLK_SFCTL) {
|
||||
|
Loading…
Reference in New Issue
Block a user