setTimeout function removed from connection handler, the finalize and error callbacks are called right away if installed on an object that already is in an error state

This commit is contained in:
Emiel Bruijntjes 2014-04-15 13:18:32 +02:00
parent 60b59524e7
commit b13398b09d
3 changed files with 7 additions and 17 deletions

View File

@ -21,22 +21,6 @@ namespace AMQP {
class ConnectionHandler
{
public:
/**
* Set a function to be executed after a given timeout.
*
* This function is not strictly necessary to implement. If you
* 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
*
*
* @todo this one should be removed
*/
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
*

View File

@ -205,6 +205,9 @@ public:
{
// store callback
_errorCallback = callback;
// if the object is already in a failed state, we call the callback right away
if (_failed) callback("Frame could not be sent");
// allow chaining
return *this;
@ -230,6 +233,9 @@ public:
// store callback
_finalizeCallback = callback;
// if the object is already in a failed state, we call the callback right away
if (_failed) callback();
// allow chaining
return *this;
}

View File

@ -134,7 +134,7 @@ void ChannelImpl::reportErrors(bool force)
Monitor monitor(this);
// report the error
auto *next = _oldestCallback->reportError("Frame could not be sent");
auto *next = _oldestCallback->reportError("Frame could not be delivered");
// leap out if object is no longer valid after the callback was called
if (!monitor.valid()) return;