summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/ConnectionMap.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-03-02 23:30:08 +0000
committerAlan Conway <aconway@apache.org>2009-03-02 23:30:08 +0000
commita179ded965c5cc70a0666d07737c38c67c1558c1 (patch)
tree9c854273164ee106eaa611dd68870d818abfc2c1 /cpp/src/qpid/cluster/ConnectionMap.cpp
parente669e97c7f1c034841986e18288af7629d356aa2 (diff)
downloadqpid-python-a179ded965c5cc70a0666d07737c38c67c1558c1.tar.gz
Replicate connection decoder fragments to new members.
Refactoring: - Merge Decoder into ConnectionMap. - Process cluster controls in event queue thread. - Use counter not pointer for connection ID, avoid re-use. - Do all processing in event queue thread to avoid races (temporary pending performance measurements) git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@749473 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/ConnectionMap.cpp')
-rw-r--r--cpp/src/qpid/cluster/ConnectionMap.cpp33
1 files changed, 10 insertions, 23 deletions
diff --git a/cpp/src/qpid/cluster/ConnectionMap.cpp b/cpp/src/qpid/cluster/ConnectionMap.cpp
index 2c024b579d..d4b2aa6675 100644
--- a/cpp/src/qpid/cluster/ConnectionMap.cpp
+++ b/cpp/src/qpid/cluster/ConnectionMap.cpp
@@ -38,9 +38,9 @@ void ConnectionMap::insert(ConnectionPtr p) {
void ConnectionMap::erase(const ConnectionId& id) {
Lock l(lock);
- Map::iterator i = map.find(id);
- QPID_ASSERT(i != map.end());
- map.erase(i);
+ size_t erased = map.erase(id);
+ assert(erased);
+ (void)erased; // Avoid unused variable warnings.
}
ConnectionMap::ConnectionPtr ConnectionMap::get(const ConnectionId& id) {
@@ -61,13 +61,6 @@ ConnectionMap::ConnectionPtr ConnectionMap::get(const ConnectionId& id) {
return i->second;
}
-ConnectionMap::ConnectionPtr ConnectionMap::getLocal(const ConnectionId& id) {
- Lock l(lock);
- if (id.getMember() != cluster.getId()) return 0;
- Map::const_iterator i = map.find(id);
- return i == map.end() ? 0 : i->second;
-}
-
ConnectionMap::Vector ConnectionMap::values() const {
Lock l(lock);
Vector result(map.size());
@@ -76,22 +69,16 @@ ConnectionMap::Vector ConnectionMap::values() const {
return result;
}
-void ConnectionMap::update(MemberId myId, const ClusterMap& cluster) {
- Lock l(lock);
- for (Map::iterator i = map.begin(); i != map.end(); ) {
- MemberId member = i->first.getMember();
- if (member != myId && !cluster.isMember(member)) {
- i->second->left();
- map.erase(i++);
- } else {
- i++;
- }
- }
-}
-
void ConnectionMap::clear() {
Lock l(lock);
map.clear();
}
+void ConnectionMap::decode(const EventHeader& eh, const void* data) {
+ ConnectionPtr connection = get(eh.getConnectionId());
+ if (connection)
+ connection->decode(eh, data);
+}
+
+
}} // namespace qpid::cluster