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--;
}
h2s->flags |= H2_SF_RST_SENT;
- h2c_stream_close(h2c, h2s);
+ h2s_close(h2s);
return ret;
}
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;
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;
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);
}
}
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;
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);
}
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);
}
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
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)
return;
if (h2s->st == H2_SS_HREM)
- h2c_stream_close(h2s->h2c, h2s);
+ h2s_close(h2s);
else
h2s->st = H2_SS_HLOC;
} else {
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))
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 */
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)
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) {