diff --git a/keepalive.cc b/keepalive.cc index facbd25..a4333c9 100644 --- a/keepalive.cc +++ b/keepalive.cc @@ -12,6 +12,10 @@ KeepAlive::KeepAlive(const std::chrono::nanoseconds& max_stale, Index* index) PCHECK(shutdown_ >= 0) << "eventfd()"; } +KeepAlive::~KeepAlive() { + PCHECK(close(shutdown_) == 0); +} + void KeepAlive::Start() { thread_ = std::thread([this]() { int timeout = 0; diff --git a/keepalive.h b/keepalive.h index 94eea8a..fe75e4e 100644 --- a/keepalive.h +++ b/keepalive.h @@ -9,6 +9,8 @@ namespace firesse { class KeepAlive { public: KeepAlive(const std::chrono::nanoseconds& max_stale, Index* index); + ~KeepAlive(); + void Start(); void Stop();