20 #ifndef PINGCONTROL_H_INCLUDED
21 #define PINGCONTROL_H_INCLUDED
29 #define MAX_PINGS_LOST 5
74 Listener* listener,
const int connectionID,
109 std::unique_ptr<ConnectionTimer> timer_;
111 const int connectionID_;
124 #endif // PINGCONTROL_H_INCLUDED
A class for connection timeout control.
Definition: PingControl.h:36
void stop()
Stops the ping control.
Definition: PingControl.cpp:47
#define MAX_PINGS_LOST
Definition: PingControl.h:29
An interface for a factory class that creates ConnectionTimers.
Definition: ConnectionTimer.h:72
A listener that must be notified by the timer on timeout.
Definition: ConnectionTimer.h:37
void start()
Starts the ping control, resetting the lost pings count.
Definition: PingControl.cpp:41
virtual ~Listener()
Destructor.
Definition: PingControl.h:49
void onPing()
Called when an incoming ping is received.
Definition: PingControl.cpp:53
virtual void connectionLost(const int connectionID)=0
Called when more than maxLost pings did not arrive as expected.
A listener class for callbacks in case loss of connection is detected.
Definition: PingControl.h:44
virtual ~PingControl()
Destructor.
Definition: PingControl.cpp:37