diff options
author | Alan Conway <aconway@apache.org> | 2012-01-18 17:15:22 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-01-18 17:15:22 +0000 |
commit | 282d049eaeb3dfcdb0fe61d80a4783832c775a89 (patch) | |
tree | 9181f7dfa620d7d8e5cb008b84bdb12986f2b971 | |
parent | 35a5d084e89475c9660c506fb080a06c58e97c0b (diff) | |
download | qpid-python-qpid-3603.tar.gz |
QPID-3603: Added public broker::Connection::isLink function.qpid-3603
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603@1232959 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/Connection.cpp | 32 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Connection.h | 4 |
2 files changed, 19 insertions, 17 deletions
diff --git a/qpid/cpp/src/qpid/broker/Connection.cpp b/qpid/cpp/src/qpid/broker/Connection.cpp index 0e20719252..73584be8fd 100644 --- a/qpid/cpp/src/qpid/broker/Connection.cpp +++ b/qpid/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) @@ -158,7 +158,7 @@ void Connection::received(framing::AMQFrame& frame) { restartTimeout(); bool wasOpen = isOpen(); 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); @@ -168,7 +168,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); @@ -207,7 +207,7 @@ void Connection::recordFromClient(const framing::AMQFrame& frame) string Connection::getAuthMechanism() { - if (!isLink) + if (!link) return string("ANONYMOUS"); return links.getAuthMechanism(mgmtId); @@ -215,7 +215,7 @@ string Connection::getAuthMechanism() string Connection::getUsername ( ) { - if (!isLink) + if (!link) return string("anonymous"); return links.getUsername(mgmtId); @@ -223,7 +223,7 @@ string Connection::getUsername ( ) string Connection::getPassword ( ) { - if (!isLink) + if (!link) return string(""); return links.getPassword(mgmtId); @@ -231,7 +231,7 @@ string Connection::getPassword ( ) string Connection::getHost ( ) { - if (!isLink) + if (!link) return string(""); return links.getHost(mgmtId); @@ -239,7 +239,7 @@ string Connection::getHost ( ) uint16_t Connection::getPort ( ) { - if (!isLink) + if (!link) return 0; return links.getPort(mgmtId); @@ -247,7 +247,7 @@ uint16_t Connection::getPort ( ) string Connection::getAuthCredentials() { - if (!isLink) + if (!link) return string(); if (mgmtObject != 0) @@ -263,7 +263,7 @@ string Connection::getAuthCredentials() void Connection::notifyConnectionForced(const string& text) { - if (isLink) + if (link) links.notifyConnectionForced(mgmtId, text); } diff --git a/qpid/cpp/src/qpid/broker/Connection.h b/qpid/cpp/src/qpid/broker/Connection.h index 3522d70b35..0f52ba7752 100644 --- a/qpid/cpp/src/qpid/broker/Connection.h +++ b/qpid/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; |