diff options
| author | 2019-07-27 19:12:29 +0100 | |
|---|---|---|
| committer | 2019-07-27 19:12:29 +0100 | |
| commit | ada6646b6546e936f5f9d91f63f9f9fc6f651ef5 (patch) | |
| tree | 817e2f69b601d4bbf0ef720a69240050c915560d /src/users.cpp | |
| parent | Remove code relating to v3 API changes and v2 module compatibility. (diff) | |
| parent | Improve the "max connections exceeded" oper snotice. (diff) | |
| download | inspircd++-ada6646b6546e936f5f9d91f63f9f9fc6f651ef5.tar.gz inspircd++-ada6646b6546e936f5f9d91f63f9f9fc6f651ef5.tar.bz2 inspircd++-ada6646b6546e936f5f9d91f63f9f9fc6f651ef5.zip | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/users.cpp')
| -rw-r--r-- | src/users.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/users.cpp b/src/users.cpp index 7453a85c3..e1f62388c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -301,6 +301,12 @@ void UserIOHandler::AddWriteBuf(const std::string &data) WriteData(data); } +void UserIOHandler::SwapInternals(UserIOHandler& other) +{ + StreamSocket::SwapInternals(other); + std::swap(checked_until, other.checked_until); +} + bool UserIOHandler::OnSetEndPoint(const irc::sockets::sockaddrs& server, const irc::sockets::sockaddrs& client) { memcpy(&user->server_sa, &server, sizeof(irc::sockets::sockaddrs)); @@ -308,9 +314,12 @@ bool UserIOHandler::OnSetEndPoint(const irc::sockets::sockaddrs& server, const i return !user->quitting; } -void UserIOHandler::OnError(BufferedSocketError) +void UserIOHandler::OnError(BufferedSocketError error) { - ServerInstance->Users.QuitUser(user, getError()); + ModResult res; + FIRST_MOD_RESULT(OnConnectionFail, res, (user, error)); + if (res != MOD_RES_ALLOW) + ServerInstance->Users.QuitUser(user, getError()); } CullResult User::cull() @@ -478,14 +487,20 @@ void LocalUser::CheckClass(bool clone_count) { ServerInstance->Users.QuitUser(this, "No more connections allowed from your host via this connect class (local)"); if (a->maxconnwarn) - ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString().c_str()); + { + ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum local connections for the %s class (%ld) exceeded by %s", + a->name.c_str(), a->GetMaxLocal(), this->GetIPString().c_str()); + } return; } else if ((a->GetMaxGlobal()) && (clonecounts.global > a->GetMaxGlobal())) { ServerInstance->Users.QuitUser(this, "No more connections allowed from your host via this connect class (global)"); if (a->maxconnwarn) - ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString().c_str()); + { + ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum global connections for the %s class (%ld) exceeded by %s", + a->name.c_str(), a->GetMaxGlobal(), this->GetIPString().c_str()); + } return; } } |
