From ba4b8d36851cfa91f8d63bf92b2c52f2d037c93a Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Mon, 8 Jul 2024 20:15:11 +0200 Subject: [PATCH] Disable heartbeats for libevent because no timers have been implemented (fixes #533) --- include/amqpcpp/libevent.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/amqpcpp/libevent.h b/include/amqpcpp/libevent.h index 4d1d19a..cb142ec 100644 --- a/include/amqpcpp/libevent.h +++ b/include/amqpcpp/libevent.h @@ -140,6 +140,22 @@ private: std::map> _watchers; + /** + * Method that is called when the heartbeat frequency is negotiated + * @param connection The connection that suggested a heartbeat interval + * @param interval The suggested interval from the server + * @return uint16_t The interval to use + */ + virtual uint16_t onNegotiate(TcpConnection *connection, uint16_t interval) override + { + // call base (in the highly theoretical case that the base class does something meaningful) + auto response = TcpHandler::onNegotiate(connection, interval); + + // because the LibEvHandler has not yet implemented timers for ensuring that we send + // some data every couple of seconds, we disabled timeouts + return 0; + } + /** * Method that is called by AMQP-CPP to register a filedescriptor for readability or writability * @param connection The TCP connection object that is reporting