MINOR: h2/trace: emit a trace of the received RST_STREAM type

Right now we don't get any state trace when receiving an RST_STREAM, and
this is not convenient because RST_STREAM(0) is not visible at all, except
in developer level because the function is entered and left.

Let's extract the RST code first and always log it using TRACE_PRINTF()
(along with h2c/h2s) so that it's possible to detect certain codes being
used.
This commit is contained in:
Willy Tarreau 2025-12-10 15:56:34 +01:00
parent 5b8e6d6811
commit 3ec5818807

View File

@ -3356,6 +3356,8 @@ static int h2c_handle_priority(struct h2c *h2c)
*/
static int h2c_handle_rst_stream(struct h2c *h2c, struct h2s *h2s)
{
int rst_code;
TRACE_ENTER(H2_EV_RX_FRAME|H2_EV_RX_RST|H2_EV_RX_EOI, h2c->conn, h2s);
/* process full frame only */
@ -3365,13 +3367,20 @@ static int h2c_handle_rst_stream(struct h2c *h2c, struct h2s *h2s)
return 0;
}
rst_code = h2_get_n32(&h2c->dbuf, 0);
TRACE_PRINTF(TRACE_LEVEL_STATE, ~0U/*H2_EV_RX_FRAME|H2_EV_RX_RST|H2_EV_RX_EOI*/, h2c->conn, h2s, 0, 0,
"received RST_STREAM(%d) : h2c=%p(%c=%s,%s,%#x) h2s=%p(%d)",
rst_code, h2c, conn_is_back(h2c->conn) ? 'B' : 'F',
h2c->proxy->id, h2c_st_to_str(h2c->st0), h2c->flags,
h2s, h2s->id);
/* late RST, already handled */
if (h2s->st == H2_SS_CLOSED) {
TRACE_DEVEL("leaving on stream closed", H2_EV_RX_FRAME|H2_EV_RX_RST|H2_EV_RX_EOI, h2c->conn, h2s);
return 1;
}
h2s->errcode = h2_get_n32(&h2c->dbuf, 0);
h2s->errcode = rst_code;
h2s_close(h2s);
if (h2s_sc(h2s)) {