From 850b7a3ace862101a944a9332d72b6bd597c17cc Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 21 Jul 2019 13:44:32 +0100 Subject: Allow modules to prevent a failed connection from being closed. --- src/usermanager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/usermanager.cpp') diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 6acd25ac5..4f65994aa 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -58,6 +58,16 @@ namespace // This user didn't answer the last ping, remove them. if (!user->lastping) { + ModResult res; + FIRST_MOD_RESULT(OnConnectionFail, res, (user, I_ERR_TIMEOUT)); + if (res == MOD_RES_ALLOW) + { + // A module is preventing this user from being timed out. + user->lastping = 1; + user->nextping = ServerInstance->Time() + user->MyClass->GetPingTime(); + return; + } + time_t secs = ServerInstance->Time() - (user->nextping - user->MyClass->GetPingTime()); const std::string message = "Ping timeout: " + ConvToStr(secs) + (secs != 1 ? " seconds" : " second"); ServerInstance->Users.QuitUser(user, message); -- cgit v1.3.1-10-gc9f91