2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2015 Attila Molnar <attilamolnar@hush.com>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 /** Handles PINGing servers and killing them on timeout
26 class PingTimer : public Timer
32 /** Warn opers next */
34 /** Kill the server next due to ping timeout */
40 /** Server the timer is interacting with
42 TreeServer* const server;
44 /** What to do when the timer ticks next
48 /** Last ping time in milliseconds, used to calculate round trip time
50 unsigned long LastPingMsec;
52 /** Update internal state and reschedule timer according to the new state
53 * @param newstate State to change to
55 void SetState(State newstate);
57 /** Process timer tick event
58 * @return State to change to
62 /** Called by the TimerManager when the timer expires
63 * @param currtime Time now
64 * @return Always false, we reschedule ourselves instead
66 bool Tick(time_t currtime) CXX11_OVERRIDE;
69 /** Construct the timer. This doesn't schedule the timer.
70 * @param server TreeServer to interact with
72 PingTimer(TreeServer* server);
74 /** Register a PONG from the server