rsocket-cpp
rsocket-cpp copied to clipboard
Reimplement KeepaliveTimer using asynctimeout
Current approach is awkward to cancel, would be cleaner to use AsyncTimeout.
timeout_ = folly::AsyncTimeout::schedule(
std::chrono::milliseconds(heartbeatIntervalMs_),
eventBase_,
[this]() noexcept { heartbeat(); });
...
timeout_->scheduleTimeout(heartbeatIntervalMs_);