count all bans towards ban_cutoff

... also (C)ompleted bans.

The previous code made a lot of sense in light of the performance issue
due to too many bans, but would not work to prune a long ban list due to
(R)equest bans at the tail, as in this example:

Present bans:
1607346873.538879 354304 C
1607346873.532313     0 C
... lots of (C)ompleted bans
1607083561.980118     0 -  req.http.Host ~ foo
1607083561.972629    15 C

The documentation does not mention the previous behavior (that only
"active" bans are being counted), so this changes aligns code to
documentation.
parent daf9b197
......@@ -371,7 +371,7 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl)
d = VTIM_real() - cache_param->ban_lurker_age;
bd = NULL;
VTAILQ_INIT(&obans);
for (; b != NULL; b = VTAILQ_NEXT(b, list)) {
for (; b != NULL; b = VTAILQ_NEXT(b, list), count++) {
if (bd != NULL)
ban_lurker_test_ban(wrk, vsl, b, &obans, bd,
count > cutoff ? 1 : 0);
......@@ -383,7 +383,6 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl)
bd = VTAILQ_NEXT(b, list);
continue;
}
count++;
n = ban_time(b->spec) - d;
if (n < 0) {
VTAILQ_INSERT_TAIL(&obans, b, l_list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment