summaryrefslogtreecommitdiff
path: root/cpp/src/qpid
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2012-05-02 17:00:54 +0000
committerCharles E. Rolke <chug@apache.org>2012-05-02 17:00:54 +0000
commite3af15eabfbaad8aa2cda4b51018938e8b149d26 (patch)
tree7359a3d4c303b3f0bfc0c78cb8afc23b87cc399c /cpp/src/qpid
parent1897e341b1c1d1bfbddb3d5b94f26b41fd7c4a5e (diff)
downloadqpid-python-e3af15eabfbaad8aa2cda4b51018938e8b149d26.tar.gz
QPID-2616 Count and limit client connections.
Bug fix: use Connection.getUserId() and not getUsername() to identify user and upgrade selftest to match. Add comment to Connection.h to suggest the particular pitfall. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1333110 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
-rw-r--r--cpp/src/qpid/acl/AclConnectionCounter.cpp10
-rw-r--r--cpp/src/qpid/broker/Connection.h5
2 files changed, 10 insertions, 5 deletions
diff --git a/cpp/src/qpid/acl/AclConnectionCounter.cpp b/cpp/src/qpid/acl/AclConnectionCounter.cpp
index 5a70c569a7..5d4e3c1544 100644
--- a/cpp/src/qpid/acl/AclConnectionCounter.cpp
+++ b/cpp/src/qpid/acl/AclConnectionCounter.cpp
@@ -104,7 +104,7 @@ void ConnectionCounter::releaseLH(
//
void ConnectionCounter::connection(broker::Connection& connection) {
QPID_LOG(trace, "ACL ConnectionCounter connection IP:" << connection.getMgmtId()
- << ", user:" << connection.getUsername());
+ << ", userId:" << connection.getUserId());
Mutex::ScopedLock locker(dataLock);
@@ -117,11 +117,11 @@ void ConnectionCounter::connection(broker::Connection& connection) {
//
void ConnectionCounter::opened(broker::Connection& connection) {
QPID_LOG(trace, "ACL ConnectionCounter Opened IP:" << connection.getMgmtId()
- << ", user:" << connection.getUsername());
+ << ", userId:" << connection.getUserId());
Mutex::ScopedLock locker(dataLock);
- const std::string& userName( connection.getUsername());
+ const std::string& userName( connection.getUserId());
const std::string& hostName(getClientHost(connection.getMgmtId()));
// Bump state from CREATED to OPENED
@@ -157,7 +157,7 @@ void ConnectionCounter::opened(broker::Connection& connection) {
//
void ConnectionCounter::closed(broker::Connection& connection) {
QPID_LOG(trace, "ACL ConnectionCounter Closed IP:" << connection.getMgmtId()
- << ", user:" << connection.getUsername());
+ << ", userId:" << connection.getUserId());
Mutex::ScopedLock locker(dataLock);
@@ -167,7 +167,7 @@ void ConnectionCounter::closed(broker::Connection& connection) {
// Normal case: connection was created and opened.
// Decrement in-use counts
releaseLH(connectByNameMap,
- connection.getUsername(),
+ connection.getUserId(),
nameLimit);
releaseLH(connectByHostMap,
diff --git a/cpp/src/qpid/broker/Connection.h b/cpp/src/qpid/broker/Connection.h
index 858ab6f7f4..1b8bd83139 100644
--- a/cpp/src/qpid/broker/Connection.h
+++ b/cpp/src/qpid/broker/Connection.h
@@ -113,15 +113,20 @@ class Connection : public sys::ConnectionInputHandler,
void requestIOProcessing (boost::function0<void>);
void recordFromServer (const framing::AMQFrame& frame);
void recordFromClient (const framing::AMQFrame& frame);
+
+ // gets for configured federation links
std::string getAuthMechanism();
std::string getAuthCredentials();
std::string getUsername();
std::string getPassword();
std::string getHost();
uint16_t getPort();
+
void notifyConnectionForced(const std::string& text);
void setUserId(const std::string& uid);
void raiseConnectEvent();
+
+ // credentials for connected client
const std::string& getUserId() const { return ConnectionState::getUserId(); }
const std::string& getMgmtId() const { return mgmtId; }
management::ManagementAgent* getAgent() const { return agent; }