From 83621790f4aab8af5787005385f8f7324c57f1a3 Mon Sep 17 00:00:00 2001 From: Martijn Otto Date: Mon, 14 Apr 2014 15:31:15 +0200 Subject: [PATCH] Give the connection object to the timeout as well --- include/connectionhandler.h | 3 ++- src/channelimpl.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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); });