fixed bug in channel.get() calls

This commit is contained in:
Emiel Bruijntjes 2014-08-04 13:44:17 +02:00
parent e299aa5fac
commit d99b117a60
1 changed files with 6 additions and 3 deletions

View File

@ -32,14 +32,17 @@ Deferred *DeferredGet::reportSuccess(uint32_t messageCount) const
// we now know the name, so we can install the message callback on the channel
_channel->install("", [channel, messageCallback, finalizeCallback](const Message &message, uint64_t deliveryTag, bool redelivered) {
// we can remove the callback now from the channel
channel->uninstall("");
// install a monitor to deal with the case that the channel is removed
Monitor monitor(channel);
// call the callbacks
if (messageCallback) messageCallback(message, deliveryTag, redelivered);
// call the finalize callback
if (finalizeCallback) finalizeCallback();
// we can remove the callback now from the channel
if (monitor.valid()) channel->uninstall("");
});
// return next object