Author: aconway
Date: Fri Jul 23 19:26:07 2010
New Revision: 967215

URL: http://svn.apache.org/viewvc?rev=967215&view=rev
Log:
QPID-2702 --max-connections does not work when using cluster.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionCodec.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionCodec.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionCodec.cpp?rev=967215&r1=967214&r2=967215&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionCodec.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionCodec.cpp Fri Jul 23 
19:26:07 2010
@@ -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



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to