summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-08-16 09:27:57 +0000
committerGordon Sim <gsim@apache.org>2010-08-16 09:27:57 +0000
commit29cc2911902581286bec11546275cb0c44ad696b (patch)
tree99d41b5b644622b34946558a3e66dc32207e19f2 /qpid/cpp/src
parentb6a46afb970b0e9f8b87a1ec26b94e93fc0828c0 (diff)
downloadqpid-python-29cc2911902581286bec11546275cb0c44ad696b.tar.gz
Fix locking in receiver impl; protect session member against concurrent fetch and init.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@985838 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp b/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp
index fb5675c129..6acd0a3ced 100644
--- a/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp
+++ b/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp
@@ -173,8 +173,13 @@ bool ReceiverImpl::fetchImpl(qpid::messaging::Message& message, qpid::messaging:
if (getImpl(message, timeout)) {
return true;
} else {
- if (state == CANCELLED) return false; // Might have been closed during get.
- sync(session).messageFlush(destination);
+ qpid::client::Session s;
+ {
+ sys::Mutex::ScopedLock l(lock);
+ if (state == CANCELLED) return false; // Might have been closed during get.
+ s = sync(session);
+ }
+ s.messageFlush(destination);
{
sys::Mutex::ScopedLock l(lock);
startFlow(l); //reallocate credit