diff options
author | Alan Conway <aconway@apache.org> | 2012-01-18 22:09:01 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-01-18 22:09:01 +0000 |
commit | d050ba65ce716f2e3006ba167b1fdd965c73e9c1 (patch) | |
tree | 8e6947d019e6a86935bc577382ea57bc8a6f711a /cpp/src | |
parent | b5c926711d6ebc66a82acf9e4b0db3689178b73c (diff) | |
download | qpid-python-d050ba65ce716f2e3006ba167b1fdd965c73e9c1.tar.gz |
QPID-3603: Added public broker::Connection::isLink function.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1233088 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/Connection.cpp | 32 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Connection.h | 4 |
2 files changed, 19 insertions, 17 deletions
diff --git a/cpp/src/qpid/broker/Connection.cpp b/cpp/src/qpid/broker/Connection.cpp index 8451f35cb0..14e9abc0d1 100644 --- a/cpp/src/qpid/broker/Connection.cpp +++ b/cpp/src/qpid/broker/Connection.cpp @@ -83,14 +83,14 @@ Connection::Connection(ConnectionOutputHandler* out_, Broker& broker_, const std::string& mgmtId_, const qpid::sys::SecuritySettings& external, - bool isLink_, + bool link_, uint64_t objectId_, bool shadow_, bool delayManagement) : ConnectionState(out_, broker_), securitySettings(external), - adapter(*this, isLink_, shadow_), - isLink(isLink_), + adapter(*this, link_, shadow_), + link(link_), mgmtClosing(false), mgmtId(mgmtId_), mgmtObject(0), @@ -103,7 +103,7 @@ Connection::Connection(ConnectionOutputHandler* out_, outboundTracker(*this) { outboundTracker.wrap(out); - if (isLink) + if (link) links.notifyConnection(mgmtId, this); // In a cluster, allow adding the management object to be delayed. if (!delayManagement) addManagementObject(); @@ -118,7 +118,7 @@ void Connection::addManagementObject() { agent = broker.getManagementAgent(); if (agent != 0) { // TODO set last bool true if system connection - mgmtObject = new _qmf::Connection(agent, this, parent, mgmtId, !isLink, false); + mgmtObject = new _qmf::Connection(agent, this, parent, mgmtId, !link, false); mgmtObject->set_shadow(shadow); agent->addObject(mgmtObject, objectId); } @@ -139,10 +139,10 @@ Connection::~Connection() mgmtObject->resourceDestroy(); // In a cluster, Connections destroyed during shutdown are in // a cluster-unsafe context. Don't raise an event in that case. - if (!isLink && isClusterSafe()) + if (!link && isClusterSafe()) agent->raiseEvent(_qmf::EventClientDisconnect(mgmtId, ConnectionState::getUserId())); } - if (isLink) + if (link) links.notifyClosed(mgmtId); if (heartbeatTimer) @@ -157,7 +157,7 @@ void Connection::received(framing::AMQFrame& frame) { // Received frame on connection so delay timeout restartTimeout(); adapter.handle(frame); - if (isLink) //i.e. we are acting as the client to another broker + if (link) //i.e. we are acting as the client to another broker recordFromServer(frame); else recordFromClient(frame); @@ -165,7 +165,7 @@ void Connection::received(framing::AMQFrame& frame) { void Connection::sent(const framing::AMQFrame& frame) { - if (isLink) //i.e. we are acting as the client to another broker + if (link) //i.e. we are acting as the client to another broker recordFromClient(frame); else recordFromServer(frame); @@ -204,7 +204,7 @@ void Connection::recordFromClient(const framing::AMQFrame& frame) string Connection::getAuthMechanism() { - if (!isLink) + if (!link) return string("ANONYMOUS"); return links.getAuthMechanism(mgmtId); @@ -212,7 +212,7 @@ string Connection::getAuthMechanism() string Connection::getUsername ( ) { - if (!isLink) + if (!link) return string("anonymous"); return links.getUsername(mgmtId); @@ -220,7 +220,7 @@ string Connection::getUsername ( ) string Connection::getPassword ( ) { - if (!isLink) + if (!link) return string(""); return links.getPassword(mgmtId); @@ -228,7 +228,7 @@ string Connection::getPassword ( ) string Connection::getHost ( ) { - if (!isLink) + if (!link) return string(""); return links.getHost(mgmtId); @@ -236,7 +236,7 @@ string Connection::getHost ( ) uint16_t Connection::getPort ( ) { - if (!isLink) + if (!link) return 0; return links.getPort(mgmtId); @@ -244,7 +244,7 @@ uint16_t Connection::getPort ( ) string Connection::getAuthCredentials() { - if (!isLink) + if (!link) return string(); if (mgmtObject != 0) @@ -260,7 +260,7 @@ string Connection::getAuthCredentials() void Connection::notifyConnectionForced(const string& text) { - if (isLink) + if (link) links.notifyConnectionForced(mgmtId, text); } diff --git a/cpp/src/qpid/broker/Connection.h b/cpp/src/qpid/broker/Connection.h index 742783c052..6186c06a3c 100644 --- a/cpp/src/qpid/broker/Connection.h +++ b/cpp/src/qpid/broker/Connection.h @@ -160,6 +160,8 @@ class Connection : public sys::ConnectionInputHandler, /** @return true if the initial connection negotiation is complete. */ bool isOpen(); + bool isLink() { return link; } + // Used by cluster during catch-up, see cluster::OutputInterceptor void doIoCallbacks(); @@ -170,7 +172,7 @@ class Connection : public sys::ConnectionInputHandler, ChannelMap channels; qpid::sys::SecuritySettings securitySettings; ConnectionHandler adapter; - const bool isLink; + const bool link; bool mgmtClosing; const std::string mgmtId; sys::Mutex ioCallbackLock; |