summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/Cluster.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-11-05 17:09:33 +0000
committerAlan Conway <aconway@apache.org>2008-11-05 17:09:33 +0000
commit8ad76093e682ee735314a6768709b77a09d152ec (patch)
tree820c8d0055018b1b675fb018d8516da3363e716a /cpp/src/qpid/cluster/Cluster.cpp
parent7f272c99e485eaa8eb38ac9b28d82637aeb4dbbc (diff)
downloadqpid-python-8ad76093e682ee735314a6768709b77a09d152ec.tar.gz
Cluster: clean up connections when a member leaves the cluster.
Fixed a memory error in cluster_test and some reporting errors in test scripts. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@711623 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Cluster.cpp')
-rw-r--r--cpp/src/qpid/cluster/Cluster.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp
index 70c73191ee..f6022aa5b8 100644
--- a/cpp/src/qpid/cluster/Cluster.cpp
+++ b/cpp/src/qpid/cluster/Cluster.cpp
@@ -565,6 +565,17 @@ void Cluster::memberUpdate(Lock& l) {
}
mgmtObject->set_members(urlstr);
}
+
+ //close connections belonging to members that have now been excluded
+ for (ConnectionMap::iterator i = connections.begin(); i != connections.end();) {
+ MemberId member = i->first.getMember();
+ if (member != myId && !map.isMember(member)) {
+ i->second->left();
+ connections.erase(i++);
+ } else {
+ i++;
+ }
+ }
}
std::ostream& operator<<(std::ostream& o, const Cluster& cluster) {