summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/SubscriptionManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/client/SubscriptionManager.cpp')
-rw-r--r--cpp/src/qpid/client/SubscriptionManager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpp/src/qpid/client/SubscriptionManager.cpp b/cpp/src/qpid/client/SubscriptionManager.cpp
index 9bb75f9a49..b4c48f7365 100644
--- a/cpp/src/qpid/client/SubscriptionManager.cpp
+++ b/cpp/src/qpid/client/SubscriptionManager.cpp
@@ -134,8 +134,11 @@ bool SubscriptionManager::get(Message& result, const std::string& queue, sys::Du
std::string unique = framing::Uuid(true).str();
subscribe(lq, queue, FlowControl::messageCredit(1), unique);
AutoCancel ac(*this, unique);
+ //first wait for message to be delivered if a timeout has been specified
+ if (timeout && lq.get(result, timeout)) return true;
+ //make sure message is not on queue before final check
sync(session).messageFlush(unique);
- return lq.get(result, timeout);
+ return lq.get(result, 0);
}
}} // namespace qpid::client