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:
parent
60b59524e7
commit
b13398b09d
|
|
@ -21,22 +21,6 @@ namespace AMQP {
|
||||||
class ConnectionHandler
|
class ConnectionHandler
|
||||||
{
|
{
|
||||||
public:
|
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
|
* Method that is called when data needs to be sent over the network
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,9 @@ public:
|
||||||
// store callback
|
// store callback
|
||||||
_errorCallback = 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
|
// allow chaining
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
@ -230,6 +233,9 @@ public:
|
||||||
// store callback
|
// store callback
|
||||||
_finalizeCallback = callback;
|
_finalizeCallback = callback;
|
||||||
|
|
||||||
|
// if the object is already in a failed state, we call the callback right away
|
||||||
|
if (_failed) callback();
|
||||||
|
|
||||||
// allow chaining
|
// allow chaining
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ void ChannelImpl::reportErrors(bool force)
|
||||||
Monitor monitor(this);
|
Monitor monitor(this);
|
||||||
|
|
||||||
// report the error
|
// 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
|
// leap out if object is no longer valid after the callback was called
|
||||||
if (!monitor.valid()) return;
|
if (!monitor.valid()) return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue