Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit ec0d938

Browse files
committed
Copy rapid reset parameters to the h2 session
Ref #3996
1 parent 852955a commit ec0d938

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

bin/varnishd/http2/cache_http2.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ struct h2_sess {
193193
VTAILQ_HEAD(,h2_req) txqueue;
194194

195195
h2_error error;
196+
197+
// rst rate limit parameters, copied from h2_* parameters
198+
vtim_dur rapid_reset;
199+
int64_t rapid_reset_limit;
200+
vtim_dur rapid_reset_period;
201+
202+
// rst rate limit state
196203
double rst_budget;
197204
vtim_real last_rst;
198205
};

bin/varnishd/http2/cache_http2_proto.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,20 +337,20 @@ h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
337337
return (0);
338338
h2_kill_req(wrk, h2, r2, h2_streamerror(vbe32dec(h2->rxf_data)));
339339

340-
if (cache_param->h2_rapid_reset_limit == 0)
340+
if (h2->rapid_reset_limit == 0)
341341
return (0);
342342

343343
now = VTIM_real();
344344
CHECK_OBJ_NOTNULL(r2->req, REQ_MAGIC);
345345
AN(r2->req->t_first);
346-
if (now - r2->req->t_first > cache_param->h2_rapid_reset)
346+
if (now - r2->req->t_first > h2->rapid_reset)
347347
return (0);
348348

349349
d = now - h2->last_rst;
350-
h2->rst_budget += cache_param->h2_rapid_reset_limit * d /
351-
cache_param->h2_rapid_reset_period;
350+
h2->rst_budget += h2->rapid_reset_limit * d /
351+
h2->rapid_reset_period;
352352
h2->rst_budget = vmin_t(double, h2->rst_budget,
353-
cache_param->h2_rapid_reset_limit);
353+
h2->rapid_reset_limit);
354354
h2->last_rst = now;
355355

356356
if (h2->rst_budget < 1.0) {

bin/varnishd/http2/cache_http2_session.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ h2_init_sess(struct sess *sp,
127127
h2_local_settings(&h2->local_settings);
128128
h2->remote_settings = H2_proto_settings;
129129
h2->decode = decode;
130-
h2->rst_budget = cache_param->h2_rapid_reset_limit;
130+
131+
h2->rapid_reset = cache_param->h2_rapid_reset;
132+
h2->rapid_reset_limit = cache_param->h2_rapid_reset_limit;
133+
h2->rapid_reset_period = cache_param->h2_rapid_reset_period;
134+
135+
h2->rst_budget = h2->rapid_reset_limit;
131136
h2->last_rst = sp->t_open;
132137
AZ(isnan(h2->last_rst));
133138

0 commit comments

Comments
 (0)