From 549fec5cb1ecc30c3d8a65c7610a89fba537923c Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Mon, 12 Nov 2018 22:07:48 +0100 Subject: [PATCH] libevhandler only checks for heartbeats if not overridden by user --- include/amqpcpp/libev.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/amqpcpp/libev.h b/include/amqpcpp/libev.h index 7a13127..416f5cd 100644 --- a/include/amqpcpp/libev.h +++ b/include/amqpcpp/libev.h @@ -189,6 +189,12 @@ private: */ ev_tstamp _expire; + /** + * Are heartbeats enabled? + * @var bool + */ + bool _enabled = false; + /** * Interval between heartbeats * @var uint16_t @@ -216,6 +222,9 @@ private: */ virtual void onExpired() override { + // do nothing if heartbeats are not enabled + if (!_enabled) return; + // get the current time ev_tstamp now = ev_now(_loop); @@ -313,6 +322,9 @@ private: */ uint16_t start() { + // remember that heartbeats are enabled + _enabled = true; + // expose the interval (the timer is already running, so we do not have to explicitly start it) return _interval; }