diff options
| author | 2023-01-21 12:54:07 +0000 | |
|---|---|---|
| committer | 2023-01-21 12:54:07 +0000 | |
| commit | 7bd8091f6ba7e91baf078c414b1c94c2199d5b4a (patch) | |
| tree | 15648c5d2c57351649b10cc0809c6d6537d09b47 /src/usermanager.cpp | |
| parent | Log the versions of third-party libraries used by modules. (diff) | |
Use the underlying transport method for pinging idle clients.
Closes #1998.
Diffstat (limited to 'src/usermanager.cpp')
| -rw-r--r-- | src/usermanager.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
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) |
