Give the connection object to the timeout as well

This commit is contained in:
Martijn Otto 2014-04-14 15:31:15 +02:00
parent f7838492fb
commit 83621790f4
2 changed files with 3 additions and 2 deletions

View File

@ -28,10 +28,11 @@ public:
* do not implement it, certain methods that fail immediately * do not implement it, certain methods that fail immediately
* will not be reported. * will not be reported.
* *
* @param connection the connection that needs the timeout
* @param timeout number of seconds to wait * @param timeout number of seconds to wait
* @param callback function to execute once time runs out * @param callback function to execute once time runs out
*/ */
virtual void setTimeout(double seconds, const std::function<void()>& callback) {} virtual void setTimeout(Connection *connection, double seconds, const std::function<void()>& callback) {}
/** /**
* Method that is called when data needs to be sent over the network * Method that is called when data needs to be sent over the network

View File

@ -553,7 +553,7 @@ Deferred<Arguments...>& ChannelImpl::send(const Frame &frame, const char *messag
// register an error on the deferred handler // register an error on the deferred handler
// after a timeout, so it gets called only // after a timeout, so it gets called only
// after a possible handler was installed. // 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 // emit an error on the handler
handler->error(message); handler->error(message);
}); });