Skip to content

Commit

Permalink
Rename new http2 rst rate limit parameters
Browse files Browse the repository at this point in the history
as agreed during bugwash.

Ref varnishcache#3996
  • Loading branch information
nigoroll committed Oct 16, 2023
1 parent f9a47f9 commit bdf391b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions bin/varnishd/http2/cache_http2_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
return (0);
h2_kill_req(wrk, h2, r2, h2_streamerror(vbe32dec(h2->rxf_data)));

if (cache_param->h2_rst_allowance == 0)
if (cache_param->h2_rapid_reset_limit == 0)
return (0);

now = VTIM_real();
d = now - h2->last_rst;
h2->rst_allowance += (1.0 * d / cache_param->h2_rst_allowance_period) *
cache_param->h2_rst_allowance;
h2->rst_allowance += (1.0 * d / cache_param->h2_rapid_reset_period) *
cache_param->h2_rapid_reset_limit;
h2->rst_allowance = vmin_t(double, h2->rst_allowance,
cache_param->h2_rst_allowance);
cache_param->h2_rapid_reset_limit);
h2->last_rst = now;

if (h2->rst_allowance < 1.0) {
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishd/http2/cache_http2_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ h2_init_sess(struct sess *sp,
h2_local_settings(&h2->local_settings);
h2->remote_settings = H2_proto_settings;
h2->decode = decode;
h2->rst_allowance = cache_param->h2_rst_allowance;
h2->rst_allowance = cache_param->h2_rapid_reset_limit;
h2->last_rst = sp->t_open;
AZ(isnan(h2->last_rst));

Expand Down
4 changes: 2 additions & 2 deletions bin/varnishtest/tests/r03996.vtc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
varnishtest "h2: Test h2_rst_allowance"
varnishtest "h2: Test h2_rapid_reset_limit"

server s1 {
rxreq
txresp
} -start

varnish v1 -cliok "param.set feature +http2"
varnish v1 -cliok "param.set h2_rst_allowance 3"
varnish v1 -cliok "param.set h2_rapid_reset_limit 3"

varnish v1 -vcl+backend {} -start

Expand Down
4 changes: 2 additions & 2 deletions include/tbl/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ PARAM_SIMPLE(
)

PARAM_SIMPLE(
/* name */ h2_rst_allowance,
/* name */ h2_rapid_reset_limit,
/* typ */ uint,
/* min */ "0",
/* max */ NULL,
Expand All @@ -1273,7 +1273,7 @@ PARAM_SIMPLE(
)

PARAM_SIMPLE(
/* name */ h2_rst_allowance_period,
/* name */ h2_rapid_reset_period,
/* typ */ timeout,
/* min */ "1.000",
/* max */ NULL,
Expand Down

0 comments on commit bdf391b

Please sign in to comment.