remove second ctor with heartbeat interval (extend class instead). Change private to protected to allow LibBoostAsioHandler to be extended.

This commit is contained in:
Steven Geddis 2018-02-01 15:27:59 +01:00
parent 33c8e76a7e
commit 5a853134aa
1 changed files with 1 additions and 24 deletions

View File

@ -47,7 +47,7 @@ namespace AMQP {
*/
class LibBoostAsioHandler : public virtual TcpHandler
{
private:
protected:
/**
* Helper class that wraps a boost io_service socket monitor.
@ -477,12 +477,6 @@ private:
*/
std::shared_ptr<Timer> _timer;
/**
* The heartbeat timer interval (in seconds).
* @var uint16_t
*/
uint16_t _timer_interval;
/**
* Method that is called by AMQP-CPP to register a filedescriptor for readability or writability
* @param connection The TCP connection object that is reporting
@ -535,9 +529,6 @@ protected:
// skip if no heartbeats are needed
if (interval == 0) return 0;
// choose heartbeat interval to use (user-specified or rabbit server default).
interval = (_timer_interval > 0) ? _timer_interval : interval;
// set the timer
_timer->set(connection, interval);
@ -567,20 +558,6 @@ public:
}
/**
* Constructor
* @param io_service The boost io_service to wrap
* @param interval The interval to use when negotiating heartbeat with rabbit server.
*/
explicit LibBoostAsioHandler(boost::asio::io_service &io_service, uint16_t interval) :
_ioservice(io_service),
_strand(std::make_shared<boost::asio::io_service::strand>(_ioservice)),
_timer(std::make_shared<Timer>(_ioservice,_strand)),
_timer_interval(interval)
{
}
/**
* Handler cannot be copied or moved
*