We now update the session's tracked counters with the observed glitches.
In order to avoid incurring a high cost, e.g. if many small frames contain
issues, we batch the updates around h2_process_demux() by directly passing
the difference. Indeed, for now all functions that increment glitches are
called from h2_process_demux(). If that were to change, we'd just need to
keep the value of the last synced counter in the h2c struct instead of the
stack.
The regtest was updated to verify that the 3rd client that does not cause
issue still sees the counter resulting from client 2's mistakes. The rate
is also verified, considering it shouldn't fail since the period is very
long (1m).
listen fe1
bind "fd@${fe1}" proto h2
- http-request return status 200 hdr x-glitches %[fc_glitches]
+ tcp-request session track-sc0 src
+ http-request return status 200 hdr x-glitches %[fc_glitches] hdr x-glitch-cnt %[sc0_glitch_cnt] hdr x-glitch-rate %[sc0_glitch_rate]
+ stick-table type ip size 10 store glitch_cnt,glitch_rate(1m)
} -start
# valid request: no glitch
rxresp
expect resp.status == 200
expect resp.http.x-glitches == 1
+ expect resp.http.x-glitch-cnt == 1
+ expect resp.http.x-glitch-rate == 1
} -run
} -run
rxresp
expect resp.status == 200
expect resp.http.x-glitches == 0
+ expect resp.http.x-glitch-cnt == 1
+ expect resp.http.x-glitch-rate == 1
} -run
} -run
if (!(h2c->flags & H2_CF_DEM_BLOCK_ANY) &&
(b_data(&h2c->dbuf) || (h2c->flags & H2_CF_RCVD_SHUT))) {
+ int prev_glitches = h2c->glitches;
+
h2_process_demux(h2c);
+ if (h2c->glitches != prev_glitches && !(h2c->flags & H2_CF_IS_BACK))
+ session_add_glitch_ctr(h2c->conn->owner, h2c->glitches - prev_glitches);
+
if (h2c->st0 >= H2_CS_ERROR || (h2c->flags & H2_CF_ERROR))
b_reset(&h2c->dbuf);