diff options
author | Ted Ross <tross@apache.org> | 2011-02-04 02:38:10 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2011-02-04 02:38:10 +0000 |
commit | 4c70dbb3985c54e35fdf722afafcb2456f8b0232 (patch) | |
tree | 1f2dbc33bf9dac3340820ad1662fd381750587e6 /qpid/cpp/src/qmf/ConsoleSession.cpp | |
parent | 71792603ee466059b54a6ae642c13b5e7d326046 (diff) | |
download | qpid-python-4c70dbb3985c54e35fdf722afafcb2456f8b0232.tar.gz |
Prevent spurious "schema-updated" notifications when an agent restarts.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1067067 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qmf/ConsoleSession.cpp')
-rw-r--r-- | qpid/cpp/src/qmf/ConsoleSession.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/qpid/cpp/src/qmf/ConsoleSession.cpp b/qpid/cpp/src/qmf/ConsoleSession.cpp index 00ea397c4b..4556c6ab94 100644 --- a/qpid/cpp/src/qmf/ConsoleSession.cpp +++ b/qpid/cpp/src/qmf/ConsoleSession.cpp @@ -481,6 +481,7 @@ void ConsoleSessionImpl::handleAgentUpdate(const string& agentName, const Varian // // This is a refresh of an agent we are already tracking. // + bool detectedRestart(false); agent = aIter->second; AgentImpl& impl(AgentImplAccess::get(agent)); impl.touch(); @@ -493,6 +494,7 @@ void ConsoleSessionImpl::handleAgentUpdate(const string& agentName, const Varian auto_ptr<ConsoleEventImpl> eventImpl(new ConsoleEventImpl(CONSOLE_AGENT_RESTART)); eventImpl->setAgent(agent); enqueueEventLH(ConsoleEvent(eventImpl.release())); + detectedRestart = true; } iter = attrs.find(protocol::AGENT_ATTR_SCHEMA_UPDATED_TIMESTAMP); @@ -501,12 +503,14 @@ void ConsoleSessionImpl::handleAgentUpdate(const string& agentName, const Varian if (ts > impl.getAttribute(protocol::AGENT_ATTR_SCHEMA_UPDATED_TIMESTAMP).asUint64()) { // // The agent has added new schema entries since we last heard from it. - // Enqueue a notification. + // Update the attribute and, if this doesn't accompany a restart, enqueue a notification. // - auto_ptr<ConsoleEventImpl> eventImpl(new ConsoleEventImpl(CONSOLE_AGENT_SCHEMA_UPDATE)); - eventImpl->setAgent(agent); - impl.setAttribute(iter->first, iter->second); - enqueueEventLH(ConsoleEvent(eventImpl.release())); + if (!detectedRestart) { + auto_ptr<ConsoleEventImpl> eventImpl(new ConsoleEventImpl(CONSOLE_AGENT_SCHEMA_UPDATE)); + eventImpl->setAgent(agent); + enqueueEventLH(ConsoleEvent(eventImpl.release())); + } + impl.setAttribute(protocol::AGENT_ATTR_SCHEMA_UPDATED_TIMESTAMP, iter->second); } } } |