diff options
author | Gordon Sim <gsim@apache.org> | 2009-11-17 10:52:53 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2009-11-17 10:52:53 +0000 |
commit | 573d0e349b2766035538260b298beb29b78598b6 (patch) | |
tree | 3d62b08e651ea78d38cf58be39650eb27187c00b /cpp/src/qpid/client/amqp0_10/SessionImpl.cpp | |
parent | dfeb9089cd7702cb70e170fcf5f5d01cbbde080c (diff) | |
download | qpid-python-573d0e349b2766035538260b298beb29b78598b6.tar.gz |
QPID-664: Cancel all senders and receivers on closing session; check queue/exchange exists before deleting.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@881237 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/amqp0_10/SessionImpl.cpp')
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/SessionImpl.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp index 3a8992d503..8545347b8c 100644 --- a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp @@ -94,6 +94,20 @@ void SessionImpl::reject(qpid::messaging::Message& m) void SessionImpl::close() { + //cancel all the senders and receivers (get copy of names and then + //make the calls to avoid modifying maps while iterating over + //them): + std::vector<std::string> s; + std::vector<std::string> r; + { + qpid::sys::Mutex::ScopedLock l(lock); + for (Senders::const_iterator i = senders.begin(); i != senders.end(); ++i) s.push_back(i->first); + for (Receivers::const_iterator i = receivers.begin(); i != receivers.end(); ++i) r.push_back(i->first); + } + for (std::vector<std::string>::const_iterator i = s.begin(); i != s.end(); ++i) getSender(*i).cancel(); + for (std::vector<std::string>::const_iterator i = r.begin(); i != r.end(); ++i) getReceiver(*i).cancel(); + + connection.closed(*this); session.close(); } |