diff options
author | Gordon Sim <gsim@apache.org> | 2010-08-16 09:27:57 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2010-08-16 09:27:57 +0000 |
commit | 755c41aa9b39777e5316eceff0006d3f02b626c2 (patch) | |
tree | 430842790069e20bc3b4399f6ac0784325fca7a5 /cpp | |
parent | d5887af51e4faec4f70260386731b38cfa3edda9 (diff) | |
download | qpid-python-755c41aa9b39777e5316eceff0006d3f02b626c2.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/qpid@985838 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp b/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp index fb5675c129..6acd0a3ced 100644 --- a/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp +++ b/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 |