1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 18:43:12 +02:00

- Throttling time is now more accurate, especially with larger time values

such as 3 connections per 60 seconds. Previously that could result in 3
  per 90 seconds due to timer inaccuracy, now max 65 seconds (max 5s
  inaccuracy).
This commit is contained in:
Bram Matthys
2009-01-24 15:38:20 +00:00
parent 98db288079
commit 8918b99248
3 changed files with 23 additions and 3 deletions
+3
View File
@@ -1742,3 +1742,6 @@
minutes if the clock was set backwards, until the time is OK again
(catches up with the original time).
This fixes #0003230 reported by Stealth, and #0002521 reported by durrie.
- Throttling time is now more accurate, especially with larger time values
such as 3 connections per 60 seconds. Previously that could result in 3 per
90 seconds due to timer inaccuracy, now max 65 seconds (max 5s inaccuracy).
+10 -2
View File
@@ -781,9 +781,17 @@ struct MODVAR ThrottlingBucket *ThrottlingHash[THROTTLING_HASH_SIZE+1];
void init_throttling_hash()
{
long v;
bzero(ThrottlingHash, sizeof(ThrottlingHash));
EventAddEx(NULL, "bucketcleaning", (THROTTLING_PERIOD ? THROTTLING_PERIOD : 120)/2, 0,
e_clean_out_throttling_buckets, NULL);
if (!THROTTLING_PERIOD)
v = 120;
else
{
v = THROTTLING_PERIOD/2;
if (v > 5)
v = 5; /* accuracy, please */
}
EventAddEx(NULL, "bucketcleaning", v, 0, e_clean_out_throttling_buckets, NULL);
}
int hash_throttling(struct IN_ADDR *in)
+10 -1
View File
@@ -2339,8 +2339,17 @@ int config_run()
#ifdef THROTTLING
{
EventInfo eInfo;
long v;
eInfo.flags = EMOD_EVERY;
eInfo.every = THROTTLING_PERIOD ? THROTTLING_PERIOD/2 : 86400;
if (!THROTTLING_PERIOD)
v = 120;
else
{
v = THROTTLING_PERIOD/2;
if (v > 5)
v = 5; /* accuracy, please */
}
eInfo.every = v;
EventMod(EventFind("bucketcleaning"), &eInfo);
}
#endif