From 7bd8091f6ba7e91baf078c414b1c94c2199d5b4a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 21 Jan 2023 12:54:07 +0000 Subject: Use the underlying transport method for pinging idle clients. Closes #1998. --- src/usermanager.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/usermanager.cpp') diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 53b6a0bef..056280c37 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -72,11 +72,24 @@ namespace return; } - // Send a ping to the client. - ClientProtocol::Messages::Ping ping; - user->Send(ServerInstance->GetRFCEvents().ping, ping); user->lastping = 0; user->nextping = ServerInstance->Time() + user->GetClass()->pingtime; + + // If the user has an I/O hook that can handle pinging use that instead. + IOHook* hook = user->eh.GetIOHook(); + while (hook) + { + if (hook->Ping()) + return; // Client has been pinged. + + IOHookMiddle* middlehook = IOHookMiddle::ToMiddleHook(hook); + hook = middlehook ? middlehook->GetNextHook() : nullptr; + } + + + // Send a ping to the client using an IRC message. + ClientProtocol::Messages::Ping ping; + user->Send(ServerInstance->GetRFCEvents().ping, ping); } void CheckConnectionTimeout(LocalUser* user) -- cgit v1.3.1-10-gc9f91