disable timer in libboostasio because it cannot handle multiple connections, fixes #251

This commit is contained in:
Emiel Bruijntjes 2018-11-11 22:51:41 +01:00
parent d6b80db194
commit fc21b62852
1 changed files with 7 additions and 13 deletions

View File

@ -478,9 +478,10 @@ protected:
/** /**
* The boost asio io_service::deadline_timer managed pointer. * The boost asio io_service::deadline_timer managed pointer.
* THIS IS DISABLED FOR NOW BECAUSE THIS BREAKS IF THERE IS MORE THAN ONE CONNECTION
* @var class std::shared_ptr<Timer> * @var class std::shared_ptr<Timer>
*/ */
std::shared_ptr<Timer> _timer; //std::shared_ptr<Timer> _timer;
/** /**
* Method that is called by AMQP-CPP to register a filedescriptor for readability or writability * Method that is called by AMQP-CPP to register a filedescriptor for readability or writability
@ -529,6 +530,8 @@ protected:
* @param interval The suggested interval from the server * @param interval The suggested interval from the server
* @return uint16_t The interval to use * @return uint16_t The interval to use
*/ */
/* THIS IS DISABLED FOR NOW BECAUSE THIS BREAKS IF THERE IS MORE THAN ONE CONNECTION */
/*
virtual uint16_t onNegotiate(TcpConnection *connection, uint16_t interval) override virtual uint16_t onNegotiate(TcpConnection *connection, uint16_t interval) override
{ {
// skip if no heartbeats are needed // skip if no heartbeats are needed
@ -540,6 +543,7 @@ protected:
// we agree with the interval // we agree with the interval
return interval; return interval;
} }
*/
public: public:
@ -556,8 +560,8 @@ public:
*/ */
explicit LibBoostAsioHandler(boost::asio::io_service &io_service) : explicit LibBoostAsioHandler(boost::asio::io_service &io_service) :
_ioservice(io_service), _ioservice(io_service),
_strand(std::make_shared<boost::asio::io_service::strand>(_ioservice)), _strand(std::make_shared<boost::asio::io_service::strand>(_ioservice))
_timer(std::make_shared<Timer>(_ioservice,_strand)) //_timer(std::make_shared<Timer>(_ioservice,_strand))
{ {
} }
@ -583,16 +587,6 @@ public:
* Destructor * Destructor
*/ */
~LibBoostAsioHandler() override = default; ~LibBoostAsioHandler() override = default;
/**
* Make sure to stop the heartbeat timer after the connection is closed.
* Otherwise it will keep the service running forever.
*/
void onClosed(TcpConnection* connection) override
{
(void)connection;
_timer.reset();
}
}; };