From 0f87ad0d4b97874823c94a5168a06dcd444ad559 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 11 Nov 2009 19:52:03 +0000 Subject: 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 --- include/users.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'include') 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. */ -- cgit v1.2.3