From c612a6c6200fd9a8f9830cbad062b30b465d3dfe Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 18 Feb 2008 21:54:02 +0000 Subject: Fixed race condition in the examples: when a listener program prints its "ready" message, the commands it has sent to the broker may not yet be complete. This results in sporadic lost messages if the producer is started immediately (e.g. by a script.) - Added Session::sync(), wait till all commands to date have completed. - Call sync() before printing "ready" in listener example programs - Removed sleep from verify script git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@628875 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/SessionBase.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cpp/src/qpid/client/SessionBase.cpp') diff --git a/cpp/src/qpid/client/SessionBase.cpp b/cpp/src/qpid/client/SessionBase.cpp index 06266ded91..9b6123cbc4 100644 --- a/cpp/src/qpid/client/SessionBase.cpp +++ b/cpp/src/qpid/client/SessionBase.cpp @@ -34,4 +34,11 @@ bool SessionBase::isSynchronous() const { return impl->isSync(); } Execution& SessionBase::getExecution() { return impl->getExecution(); } Uuid SessionBase::getId() const { return impl->getId(); } framing::FrameSet::shared_ptr SessionBase::get() { return impl->get(); } + +void SessionBase::sync() { + Execution& ex = getExecution(); + ex.syncWait(ex.lastSent()); + impl->assertOpen(); +} + }} // namespace qpid::client -- cgit v1.2.1