diff --git a/include/connectionhandler.h b/include/connectionhandler.h index 84210f2..2ffe23b 100644 --- a/include/connectionhandler.h +++ b/include/connectionhandler.h @@ -28,10 +28,11 @@ public: * do not implement it, certain methods that fail immediately * will not be reported. * + * @param connection the connection that needs the timeout * @param timeout number of seconds to wait * @param callback function to execute once time runs out */ - virtual void setTimeout(double seconds, const std::function& callback) {} + virtual void setTimeout(Connection *connection, double seconds, const std::function& callback) {} /** * Method that is called when data needs to be sent over the network diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index 8607026..4609d0d 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -553,7 +553,7 @@ Deferred& ChannelImpl::send(const Frame &frame, const char *messag // register an error on the deferred handler // after a timeout, so it gets called only // after a possible handler was installed. - _connection->_handler->setTimeout(0, [handler, message]() { + _connection->_handler->setTimeout(_connection->_parent, 0, [handler, message]() { // emit an error on the handler handler->error(message); });