Fixed compilation issue due to recent changes in ChannelImpl

This commit is contained in:
Okke 2017-03-03 12:56:54 +01:00
parent d3c0ea293b
commit 055431de6e
2 changed files with 30 additions and 20 deletions

View File

@ -213,26 +213,7 @@ public:
*
* @param callback the callback to execute
*/
void onError(const ErrorCallback &callback)
{
// store callback
_errorCallback = callback;
// if the channel is connected, all is ok
if (connected()) return;
// is the channel closing down?
if (_state == state_closing) return callback("Channel is closing down");
// the channel is closed, but what is the connection doing?
if (_connection == nullptr) return callback("Channel is not linked to a connection");
// if the connection is valid, this is a pure channel error
if (_connection->connected()) return callback("Channel is in an error state, but the connection is valid");
// direct call if channel is already in error state
callback("Channel is in error state because no AMQP connection is available");
}
void onError(const ErrorCallback &callback);
/**
* Pause deliveries on a channel

View File

@ -60,6 +60,35 @@ ChannelImpl::~ChannelImpl()
if (_connection) _connection->remove(this);
}
/**
* Callback that is called when an error occurs.
*
* Only one error callback can be registered. Calling this function
* multiple times will remove the old callback.
*
* @param callback the callback to execute
*/
void ChannelImpl::onError(const ErrorCallback &callback)
{
// store callback
_errorCallback = callback;
// if the channel is connected, all is ok
if (connected()) return;
// is the channel closing down?
if (_state == state_closing) return callback("Channel is closing down");
// the channel is closed, but what is the connection doing?
if (_connection == nullptr) return callback("Channel is not linked to a connection");
// if the connection is valid, this is a pure channel error
if (_connection->connected()) return callback("Channel is in an error state, but the connection is valid");
// direct call if channel is already in error state
callback("Channel is in error state because no AMQP connection is available");
}
/**
* Initialize the object with an connection
* @param connection