summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qmf/ConsoleSession.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2010-11-10 22:30:38 +0000
committerTed Ross <tross@apache.org>2010-11-10 22:30:38 +0000
commit565d6ce4f20a55e9c4355c9adc75ca328b4e0cc5 (patch)
treeef45c11a4756b88e5995697e0b5c21e53cb7628c /qpid/cpp/src/qmf/ConsoleSession.cpp
parentbd14418733310121b6cdef34af8b3c0c2cd2bc7f (diff)
downloadqpid-python-565d6ce4f20a55e9c4355c9adc75ca328b4e0cc5.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@1033763 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qmf/ConsoleSession.cpp')
-rw-r--r--qpid/cpp/src/qmf/ConsoleSession.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/qpid/cpp/src/qmf/ConsoleSession.cpp b/qpid/cpp/src/qmf/ConsoleSession.cpp
index 6eb9b94bf8..dc2bbe34ee 100644
--- a/qpid/cpp/src/qmf/ConsoleSession.cpp
+++ b/qpid/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;
}