summaryrefslogtreecommitdiff
path: root/cpp/src/qmf/ConsoleSession.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2011-03-07 19:13:56 +0000
committerTed Ross <tross@apache.org>2011-03-07 19:13:56 +0000
commit13b49ccb8917b4f71707c4d2cebe40a2514f2c3d (patch)
treefe5a363d0b5985c1f3806b6ad4dff6fcdbba062b /cpp/src/qmf/ConsoleSession.cpp
parentbc0c22d441cf075411d6df69a4410ce651c7f46c (diff)
downloadqpid-python-13b49ccb8917b4f71707c4d2cebe40a2514f2c3d.tar.gz
QPID_3122 - Added backward-compatible map keys in QMFv2 consoles for earlier development agents.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1078895 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/ConsoleSession.cpp')
-rw-r--r--cpp/src/qmf/ConsoleSession.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/cpp/src/qmf/ConsoleSession.cpp b/cpp/src/qmf/ConsoleSession.cpp
index 2136a7d449..7b839930e1 100644
--- a/cpp/src/qmf/ConsoleSession.cpp
+++ b/cpp/src/qmf/ConsoleSession.cpp
@@ -429,7 +429,23 @@ void ConsoleSessionImpl::handleAgentUpdate(const string& agentName, const Varian
iter = content.find("_values");
if (iter == content.end())
return;
- Variant::Map attrs(iter->second.asMap());
+ const Variant::Map& in_attrs(iter->second.asMap());
+ Variant::Map attrs;
+
+ //
+ // Copy the map from the message to "attrs". Translate any old-style
+ // keys to their new key values in the process.
+ //
+ for (iter = in_attrs.begin(); iter != in_attrs.end(); iter++) {
+ if (iter->first == "epoch")
+ attrs[protocol::AGENT_ATTR_EPOCH] = iter->second;
+ else if (iter->first == "timestamp")
+ attrs[protocol::AGENT_ATTR_TIMESTAMP] = iter->second;
+ else if (iter->first == "heartbeat_interval")
+ attrs[protocol::AGENT_ATTR_HEARTBEAT_INTERVAL] = iter->second;
+ else
+ attrs[iter->first] = iter->second;
+ }
iter = attrs.find(protocol::AGENT_ATTR_EPOCH);
if (iter != attrs.end())