From b43bdbc0002b0d24b5efa3c595b7e989380bfab3 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Fri, 4 Feb 2011 02:38:10 +0000 Subject: 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 --- cpp/src/qmf/ConsoleSession.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'cpp/src') 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 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 eventImpl(new ConsoleEventImpl(CONSOLE_AGENT_SCHEMA_UPDATE)); - eventImpl->setAgent(agent); - impl.setAttribute(iter->first, iter->second); - enqueueEventLH(ConsoleEvent(eventImpl.release())); + if (!detectedRestart) { + auto_ptr eventImpl(new ConsoleEventImpl(CONSOLE_AGENT_SCHEMA_UPDATE)); + eventImpl->setAgent(agent); + enqueueEventLH(ConsoleEvent(eventImpl.release())); + } + impl.setAttribute(protocol::AGENT_ATTR_SCHEMA_UPDATED_TIMESTAMP, iter->second); } } } -- cgit v1.2.1