summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-07-23 19:26:07 +0000
committerAlan Conway <aconway@apache.org>2010-07-23 19:26:07 +0000
commitd3933dab7a7e224bc31bdf58b74d428bbb942d30 (patch)
treea8a4f4642bb363b001e648b5f1368083d801a882 /cpp
parent862ca683b8ec496e0297962ee8911329db752ac9 (diff)
downloadqpid-python-d3933dab7a7e224bc31bdf58b74d428bbb942d30.tar.gz
QPID-2702 --max-connections does not work when using cluster.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@967215 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/cluster/ConnectionCodec.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/cpp/src/qpid/cluster/ConnectionCodec.cpp b/cpp/src/qpid/cluster/ConnectionCodec.cpp
index 91ec10903c..d0ba8abfb3 100644
--- a/cpp/src/qpid/cluster/ConnectionCodec.cpp
+++ b/cpp/src/qpid/cluster/ConnectionCodec.cpp
@@ -36,8 +36,17 @@ namespace cluster {
using namespace framing;
sys::ConnectionCodec*
-ConnectionCodec::Factory::create(ProtocolVersion v, sys::OutputControl& out, const std::string& id,
- const qpid::sys::SecuritySettings& external) {
+ConnectionCodec::Factory::create(ProtocolVersion v, sys::OutputControl& out,
+ const std::string& id,
+ const qpid::sys::SecuritySettings& external)
+{
+ broker::Broker& broker = cluster.getBroker();
+ if (broker.getConnectionCounter().allowConnection())
+ {
+ QPID_LOG(error, "Client max connection count limit exceeded: "
+ << broker.getOptions().maxConnections << " connection refused");
+ return 0;
+ }
if (v == ProtocolVersion(0, 10))
return new ConnectionCodec(v, out, id, cluster, false, false, external);
else if (v == ProtocolVersion(0x80 + 0, 0x80 + 10)) // Catch-up connection