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 | b43bdbc0002b0d24b5efa3c595b7e989380bfab3 (patch) | |
tree | af6ed0438f6f0fc6aef1e8eba9a74751824c498b /cpp/src/qmf/ConsoleSession.cpp | |
parent | 25dd988f6c5daafd058447c95bcd6a2a349ad45f (diff) | |
download | qpid-python-b43bdbc0002b0d24b5efa3c595b7e989380bfab3.tar.gz |
Prevent spurious "schema-updated" notifications when an agent restarts.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1067067 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/ConsoleSession.cpp')
-rw-r--r-- | cpp/src/qmf/ConsoleSession.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cpp/src/qmf/ConsoleSession.cpp b/cpp/src/qmf/ConsoleSession.cpp index 00ea397c4b..4556c6ab94 100644 --- a/cpp/src/qmf/ConsoleSession.cpp +++ b/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); } } } |