mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 23:02:01 +00:00
Fix case where interval overflows (thanks jackeri)
[17:58] <Jacker> hey, you might be interested in checking out this4da5a397b5 (diff-acaedc9d8b492f9af8966ae68597392cR615)
[17:58] <Jacker> its related to the ddos protection code you wrote [17:59] <Jacker> in continuation to:ab9b08e584
[17:59] <Jacker> in a case if the client has in the past connected to the server days/weeks earlier and time wraps the client wont be able to connect [18:00] <Jacker> since in that case if the bucket of that clients ip still exists it wont get checked correctly
This commit is contained in:
parent
458ab7716c
commit
dd82b9d1a8
1 changed files with 1 additions and 1 deletions
|
@ -487,7 +487,7 @@ qboolean SVC_RateLimit( leakyBucket_t *bucket, int burst, int period ) {
|
|||
int expired = interval / period;
|
||||
int expiredRemainder = interval % period;
|
||||
|
||||
if ( expired > bucket->burst ) {
|
||||
if ( expired > bucket->burst || interval < 0 ) {
|
||||
bucket->burst = 0;
|
||||
bucket->lastTime = now;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue