diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-01-19 17:31:54 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-01-19 17:31:54 +0400 |
commit | 2356f41ba7bd042f39d9ca0a62b1319fa588dd4a (patch) | |
tree | eea04f6d08899cde33c239e59d655e2306c2966c /accel-pppd | |
parent | 0875732ca32f08b423c404d8bd1605e839e2caf4 (diff) | |
download | accel-ppp-2356f41ba7bd042f39d9ca0a62b1319fa588dd4a.tar.gz accel-ppp-2356f41ba7bd042f39d9ca0a62b1319fa588dd4a.zip |
connlimit: check for burst timeout before check burst counter
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/extra/connlimit.c | 12 |
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; } |