diff options
author | Rutger <djslash+github@djslash.org> | 2012-04-01 21:11:25 +0200 |
---|---|---|
committer | Rutger <djslash+github@djslash.org> | 2012-04-01 21:11:25 +0200 |
commit | 10e0af3831cf29399541d4e2f6f2d6adfb7672bb (patch) | |
tree | 53437dad2cfc24964d4b25db74f1b280c4b1c2a3 /src | |
parent | e73e4be15485f545ff485d3d372b513dd28bf759 (diff) |
Add <connect:maxconnwarn>
Created the maxconnwarn variable in the connect block, so you can make
connect blocks that only warns about max connections if you want to.
This reduces noise from connecting clients that have low maxlocal and/or
maxglobal. It is enabled by default.
Diffstat (limited to 'src')
-rw-r--r-- | src/configreader.cpp | 1 | ||||
-rw-r--r-- | src/users.cpp | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 6ef5105aa..a1a244501 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -375,6 +375,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) me->maxlocal = tag->getInt("localmax", me->maxlocal); me->maxglobal = tag->getInt("globalmax", me->maxglobal); me->maxchans = tag->getInt("maxchans", me->maxchans); + me->maxconnwarn = tag->getBool("maxconnwarn", me->maxconnwarn); me->limit = tag->getInt("limit", me->limit); ClassMap::iterator oldMask = oldBlocksByMask.find(typeMask); diff --git a/src/users.cpp b/src/users.cpp index 7f8e3df8a..6277f95f9 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -734,13 +734,15 @@ void LocalUser::CheckClass() else if ((a->GetMaxLocal()) && (ServerInstance->Users->LocalCloneCount(this) > a->GetMaxLocal())) { ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (local)"); - ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString()); + if (a->maxconnwarn) + ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString()); return; } else if ((a->GetMaxGlobal()) && (ServerInstance->Users->GlobalCloneCount(this) > a->GetMaxGlobal())) { ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (global)"); - ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString()); + if (a->maxconnwarn) + ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString()); return; } @@ -1693,7 +1695,7 @@ const std::string& FakeUser::GetFullRealHost() ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask) : config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask), pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0), - penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxchans(0), limit(0) + penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0), limit(0) { } @@ -1702,7 +1704,7 @@ ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask, cons registration_timeout(parent.registration_timeout), host(mask), pingtime(parent.pingtime), softsendqmax(parent.softsendqmax), hardsendqmax(parent.hardsendqmax), recvqmax(parent.recvqmax), penaltythreshold(parent.penaltythreshold), commandrate(parent.commandrate), - maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxchans(parent.maxchans), + maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxconnwarn(parent.maxconnwarn), maxchans(parent.maxchans), limit(parent.limit) { } @@ -1723,6 +1725,7 @@ void ConnectClass::Update(const ConnectClass* src) commandrate = src->commandrate; maxlocal = src->maxlocal; maxglobal = src->maxglobal; + maxconnwarn = src->maxconnwarn; maxchans = src->maxchans; limit = src->limit; } |