summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-01-19 17:31:54 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-01-19 17:31:54 +0400
commit2356f41ba7bd042f39d9ca0a62b1319fa588dd4a (patch)
treeeea04f6d08899cde33c239e59d655e2306c2966c
parent0875732ca32f08b423c404d8bd1605e839e2caf4 (diff)
downloadaccel-ppp-2356f41ba7bd042f39d9ca0a62b1319fa588dd4a.tar.gz
accel-ppp-2356f41ba7bd042f39d9ca0a62b1319fa588dd4a.zip
connlimit: check for burst timeout before check burst counter
-rw-r--r--accel-pppd/extra/connlimit.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/accel-pppd/extra/connlimit.c b/accel-pppd/extra/connlimit.c
index 56a08954..243634e7 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;
}