diff options
author | Kim van der Riet <kpvdr@apache.org> | 2013-02-28 16:14:30 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2013-02-28 16:14:30 +0000 |
commit | 9c73ef7a5ac10acd6a50d5d52bd721fc2faa5919 (patch) | |
tree | 2a890e1df09e5b896a9b4168a7b22648f559a1f2 /cpp/src/qpid/broker/ConnectionHandler.cpp | |
parent | 172d9b2a16cfb817bbe632d050acba7e31401cd2 (diff) | |
download | qpid-python-asyncstore.tar.gz |
Update from trunk r1375509 through r1450773asyncstore
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1451244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/ConnectionHandler.cpp')
-rw-r--r-- | cpp/src/qpid/broker/ConnectionHandler.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/cpp/src/qpid/broker/ConnectionHandler.cpp b/cpp/src/qpid/broker/ConnectionHandler.cpp index 06f442a47f..977c706ebd 100644 --- a/cpp/src/qpid/broker/ConnectionHandler.cpp +++ b/cpp/src/qpid/broker/ConnectionHandler.cpp @@ -20,8 +20,10 @@ * */ -#include "qpid/SaslFactory.h" #include "qpid/broker/ConnectionHandler.h" + +#include "qpid/SaslFactory.h" +#include "qpid/broker/Broker.h" #include "qpid/broker/Connection.h" #include "qpid/broker/SecureConnection.h" #include "qpid/Url.h" @@ -30,8 +32,10 @@ #include "qpid/framing/enum.h" #include "qpid/framing/FieldValue.h" #include "qpid/log/Statement.h" +#include "qpid/management/ManagementAgent.h" #include "qpid/sys/SecurityLayer.h" #include "qpid/broker/AclModule.h" +#include "qpid/amqp_0_10/Codecs.h" #include "qmf/org/apache/qpid/broker/EventClientConnectFail.h" using namespace qpid; @@ -148,6 +152,24 @@ void ConnectionHandler::Handler::startOk(const framing::FieldTable& /*clientProp void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body) { + const framing::FieldTable& clientProperties = body.getClientProperties(); + qmf::org::apache::qpid::broker::Connection::shared_ptr mgmtObject = connection.getMgmtObject(); + + if (mgmtObject != 0) { + string procName = clientProperties.getAsString(CLIENT_PROCESS_NAME); + uint32_t pid = clientProperties.getAsInt(CLIENT_PID); + uint32_t ppid = clientProperties.getAsInt(CLIENT_PPID); + + types::Variant::Map properties; + qpid::amqp_0_10::translate(clientProperties, properties); + mgmtObject->set_remoteProperties(properties); + if (!procName.empty()) + mgmtObject->set_remoteProcessName(procName); + if (pid != 0) + mgmtObject->set_remotePid(pid); + if (ppid != 0) + mgmtObject->set_remoteParentPid(ppid); + } try { authenticator->start(body.getMechanism(), body.hasResponse() ? &body.getResponse() : 0); } catch (std::exception& /*e*/) { @@ -160,8 +182,9 @@ void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body) string uid; authenticator->getError(error); authenticator->getUid(uid); - if (agent) { - agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error)); + if (agent && mgmtObject) { + agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error, + mgmtObject->get_remoteProperties())); } QPID_LOG_CAT(debug, model, "Failed connection. rhost:" << connection.getMgmtId() << " user:" << uid @@ -169,9 +192,8 @@ void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body) } throw; } - const framing::FieldTable& clientProperties = body.getClientProperties(); - connection.setClientProperties(clientProperties); + connection.setClientProperties(clientProperties); connection.setFederationLink(clientProperties.get(QPID_FED_LINK)); if (clientProperties.isSet(QPID_FED_TAG)) { connection.setFederationPeerTag(clientProperties.getAsString(QPID_FED_TAG)); @@ -187,19 +209,6 @@ void ConnectionHandler::Handler::startOk(const ConnectionStartOkBody& body) } QPID_LOG(info, "Connection is a federation link"); } - - if (connection.getMgmtObject() != 0) { - string procName = clientProperties.getAsString(CLIENT_PROCESS_NAME); - uint32_t pid = clientProperties.getAsInt(CLIENT_PID); - uint32_t ppid = clientProperties.getAsInt(CLIENT_PPID); - - if (!procName.empty()) - connection.getMgmtObject()->set_remoteProcessName(procName); - if (pid != 0) - connection.getMgmtObject()->set_remotePid(pid); - if (ppid != 0) - connection.getMgmtObject()->set_remoteParentPid(ppid); - } } void ConnectionHandler::Handler::secureOk(const string& response) @@ -216,8 +225,9 @@ void ConnectionHandler::Handler::secureOk(const string& response) string uid; authenticator->getError(error); authenticator->getUid(uid); - if (agent) { - agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error)); + if (agent && connection.getMgmtObject()) { + agent->raiseEvent(_qmf::EventClientConnectFail(connection.getMgmtId(), uid, error, + connection.getMgmtObject()->get_remoteProperties())); } QPID_LOG_CAT(debug, model, "Failed connection. rhost:" << connection.getMgmtId() << " user:" << uid |