25 lines
516 B
C++
25 lines
516 B
C++
#pragma once
|
|
|
|
#include <boost/asio/steady_timer.hpp>
|
|
|
|
#include <memory>
|
|
|
|
class Connection;
|
|
|
|
class WatchdogThread : std::enable_shared_from_this<WatchdogThread>
|
|
{
|
|
Connection& connection_;
|
|
boost::asio::steady_timer timer_;
|
|
bool tried_ping;
|
|
|
|
auto on_activity() -> void;
|
|
auto timeout_token();
|
|
auto on_timeout() -> void;
|
|
auto on_connect() -> void;
|
|
auto on_disconnect() -> void;
|
|
|
|
public:
|
|
WatchdogThread(Connection& connection);
|
|
static auto start(Connection& connection) -> void;
|
|
};
|