diff options
author | Alan Conway <aconway@apache.org> | 2009-02-25 14:11:19 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-02-25 14:11:19 +0000 |
commit | 56dfac7334ce38be1b093cf9469e41f5611b3da8 (patch) | |
tree | ba8afa7807955b6285aa1d540d4d24eb3b67a539 /cpp/src | |
parent | 001477bd198bebc60d74c4868ec44051669d5d90 (diff) | |
download | qpid-python-56dfac7334ce38be1b093cf9469e41f5611b3da8.tar.gz |
Fix race condition: move all calls on Decoder into event delivery thread.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@747789 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/cluster/Cluster.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 6221b0054c..7285b85991 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -163,7 +163,6 @@ void Cluster::addShadowConnection(const boost::intrusive_ptr<Connection>& c) { void Cluster::erase(const ConnectionId& id) { // Called only by Connection::deliverClose in deliver thread, no need to lock. connections.erase(id); - decoder.erase(id); } std::vector<string> Cluster::getIds() const { @@ -231,9 +230,14 @@ void Cluster::deliveredEvent(const Event& e) { Buffer buf(const_cast<char*>(e.getData()), e.getSize()); if (e.getType() == CONTROL) { AMQFrame frame; - while (frame.decode(buf)) + while (frame.decode(buf)) { + // Check for deliver close here so we can erase the + // connection decoder safely in this thread. + if (frame.getMethod()->isA<ClusterConnectionDeliverCloseBody>()) + decoder.erase(e.getConnectionId()); deliverFrameQueue.push(EventFrame(e, frame)); } + } else if (e.getType() == DATA) decoder.decode(e, e.getData()); } |