QPID-3603: Added public broker::Connection::isLink function.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603@1232959 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/qpid/cpp/src/qpid/broker/Connection.cpp b/qpid/cpp/src/qpid/broker/Connection.cpp
index 0e20719..73584be 100644
--- a/qpid/cpp/src/qpid/broker/Connection.cpp
+++ b/qpid/cpp/src/qpid/broker/Connection.cpp
@@ -83,14 +83,14 @@
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 @@
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 @@
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 @@
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 @@
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::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 @@
string Connection::getAuthMechanism()
{
- if (!isLink)
+ if (!link)
return string("ANONYMOUS");
return links.getAuthMechanism(mgmtId);
@@ -215,7 +215,7 @@
string Connection::getUsername ( )
{
- if (!isLink)
+ if (!link)
return string("anonymous");
return links.getUsername(mgmtId);
@@ -223,7 +223,7 @@
string Connection::getPassword ( )
{
- if (!isLink)
+ if (!link)
return string("");
return links.getPassword(mgmtId);
@@ -231,7 +231,7 @@
string Connection::getHost ( )
{
- if (!isLink)
+ if (!link)
return string("");
return links.getHost(mgmtId);
@@ -239,7 +239,7 @@
uint16_t Connection::getPort ( )
{
- if (!isLink)
+ if (!link)
return 0;
return links.getPort(mgmtId);
@@ -247,7 +247,7 @@
string Connection::getAuthCredentials()
{
- if (!isLink)
+ if (!link)
return string();
if (mgmtObject != 0)
@@ -263,7 +263,7 @@
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 3522d70..0f52ba7 100644
--- a/qpid/cpp/src/qpid/broker/Connection.h
+++ b/qpid/cpp/src/qpid/broker/Connection.h
@@ -160,6 +160,8 @@
/** @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 @@
ChannelMap channels;
qpid::sys::SecuritySettings securitySettings;
ConnectionHandler adapter;
- const bool isLink;
+ const bool link;
bool mgmtClosing;
const std::string mgmtId;
sys::Mutex ioCallbackLock;