From 2356f41ba7bd042f39d9ca0a62b1319fa588dd4a Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Thu, 19 Jan 2012 17:31:54 +0400 Subject: connlimit: check for burst timeout before check burst counter --- accel-pppd/extra/connlimit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'accel-pppd/extra') diff --git a/accel-pppd/extra/connlimit.c b/accel-pppd/extra/connlimit.c index 56a0895..243634e 100644 --- a/accel-pppd/extra/connlimit.c +++ b/accel-pppd/extra/connlimit.c @@ -45,6 +45,11 @@ int __export connlimit_check(uint64_t key) d = (ts.tv_sec - it->ts.tv_sec) * 1000 + (ts.tv_nsec - it->ts.tv_nsec) / 1000000; if (it->key == key) { + if (d >= conf_burst_timeout) { + it->ts = ts; + list_move(&it->entry, &items); + it->count = 0; + } it->count++; if (it->count >= conf_burst) { if (d >= conf_limit_timeout) { @@ -53,13 +58,8 @@ int __export connlimit_check(uint64_t key) r = 0; } else r = -1; - } else { - if (d >= conf_burst_timeout) { - it->ts = ts; - list_move(&it->entry, &items); - } + } else r = 0; - } break; } -- cgit v1.2.3