diff options
author | Ted Ross <tross@apache.org> | 2010-11-10 22:30:38 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2010-11-10 22:30:38 +0000 |
commit | 72897efdcb587221bd8bec5af6ffa57092e8cab7 (patch) | |
tree | 19b619d7ca5852f5d5f6dc228ca043dc75bf4edf /cpp/src/qmf/ConsoleSession.cpp | |
parent | 332081014d8a62c8f75c36b9d53af01e29b1f9af (diff) | |
download | qpid-python-72897efdcb587221bd8bec5af6ffa57092e8cab7.tar.gz |
Fixed segfault when setting the agent filter on a closed session.
Fixed notification for the connected-broker agent.
Added an example console program in c++ to monitor the set of agents.
Fixed the Python agent example to more elegantly handle connection failure.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1033763 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/ConsoleSession.cpp')
-rw-r--r-- | cpp/src/qmf/ConsoleSession.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cpp/src/qmf/ConsoleSession.cpp b/cpp/src/qmf/ConsoleSession.cpp index 6eb9b94bf8..dc2bbe34ee 100644 --- a/cpp/src/qmf/ConsoleSession.cpp +++ b/cpp/src/qmf/ConsoleSession.cpp @@ -110,9 +110,17 @@ void ConsoleSessionImpl::setAgentFilter(const string& predicate) enqueueEventLH(eventImpl.release()); } - if (!connectedBrokerInAgentList && agentQuery.matchesPredicate(connectedBrokerAgent.getAttributes())) { + if (!connectedBrokerInAgentList && connectedBrokerAgent.isValid() && + agentQuery.matchesPredicate(connectedBrokerAgent.getAttributes())) { agents[connectedBrokerAgent.getName()] = connectedBrokerAgent; connectedBrokerInAgentList = true; + + // + // Enqueue a notification of the new agent. + // + auto_ptr<ConsoleEventImpl> eventImpl(new ConsoleEventImpl(CONSOLE_AGENT_ADD)); + eventImpl->setAgent(connectedBrokerAgent); + enqueueEventLH(ConsoleEvent(eventImpl.release())); } } @@ -393,6 +401,13 @@ void ConsoleSessionImpl::handleAgentUpdate(const string& agentName, const Varian if (!agentQuery || agentQuery.matchesPredicate(attrs)) { connectedBrokerInAgentList = true; agents[agentName] = agent; + + // + // Enqueue a notification of the new agent. + // + auto_ptr<ConsoleEventImpl> eventImpl(new ConsoleEventImpl(CONSOLE_AGENT_ADD)); + eventImpl->setAgent(agent); + enqueueEventLH(ConsoleEvent(eventImpl.release())); } return; } |