Fix case where interval overflows (thanks jackeri)
[17:58] <Jacker> hey, you might be interested in checking out this
https://github.com/etlegacy/etlegacy/commit/4da5a397b5994bfe5fddb9dad35bef5ddbea64c9#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:
1 parent
458ab7716c
commit
dd82b9d1a8
1 file changed
+1
-1
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user