summaryrefslogtreecommitdiff
path: root/include/users.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-11-11 19:52:03 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-11-11 19:52:03 +0000
commit0f87ad0d4b97874823c94a5168a06dcd444ad559 (patch)
tree81b0aba7a008a140bf326608e6b6670b31b5c958 /include/users.h
parent704c793d479f835180e9d89d82cd21a2c6c6521d (diff)
Add fine-grained command flood controls
This reintrouces "Excess Flood" quits for those that prefer it to fakelag, and allows the maximum command rate to be set in the connect block. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12093 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/users.h')
-rw-r--r--include/users.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/users.h b/include/users.h
index 5cf7669af..e1171e2c3 100644
--- a/include/users.h
+++ b/include/users.h
@@ -71,6 +71,9 @@ struct CoreExport ConnectClass : public refcountbase
*/
char type;
+ /** True if this class uses fake lag to manage flood, false if it kills */
+ bool fakelag;
+
/** Connect class name
*/
std::string name;
@@ -111,7 +114,10 @@ struct CoreExport ConnectClass : public refcountbase
/** Seconds worth of penalty before penalty system activates
*/
- unsigned long penaltythreshold;
+ unsigned int penaltythreshold;
+
+ /** Maximum rate of commands (units: millicommands per second) */
+ unsigned int commandrate;
/** Local max when connecting by this connection class
*/
@@ -188,9 +194,14 @@ struct CoreExport ConnectClass : public refcountbase
/** Returns the penalty threshold value
*/
- unsigned long GetPenaltyThreshold()
+ unsigned int GetPenaltyThreshold()
+ {
+ return (penaltythreshold ? penaltythreshold : 10);
+ }
+
+ unsigned int GetCommandRate()
{
- return penaltythreshold;
+ return commandrate ? commandrate : 1000;
}
/** Returusn the maximum number of local sessions
@@ -787,10 +798,10 @@ class CoreExport LocalUser : public User
*/
time_t nping;
- /** This value contains how far into the penalty threshold the user is. Once its over
- * the penalty threshold then commands are held and processed on-timer.
+ /** This value contains how far into the penalty threshold the user is.
+ * This is used either to enable fake lag or for excess flood quits
*/
- int Penalty;
+ unsigned int CommandFloodPenalty;
/** Stored reverse lookup from res_forward. Should not be used after resolution.
*/