You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2009/03/12 16:28:02 UTC

svn commit: r752897 - in /qpid/trunk/qpid/cpp/src/qpid/broker: ConnectionHandler.cpp ConnectionHandler.h

Author: gsim
Date: Thu Mar 12 15:28:02 2009
New Revision: 752897

URL: http://svn.apache.org/viewvc?rev=752897&view=rev
Log:
QPID-1728: Avoid logging error messages on 'shadow' connections that are outgoing links.


Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp?rev=752897&r1=752896&r2=752897&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp Thu Mar 12 15:28:02 2009
@@ -24,8 +24,7 @@
 #include "Connection.h"
 #include "SecureConnection.h"
 #include "qpid/Url.h"
-#include "qpid/framing/ClientInvoker.h"
-#include "qpid/framing/ServerInvoker.h"
+#include "qpid/framing/AllInvoker.h"
 #include "qpid/framing/enum.h"
 #include "qpid/log/Statement.h"
 #include "qpid/sys/SecurityLayer.h"
@@ -54,32 +53,25 @@
 
 void ConnectionHandler::close(connection::CloseCode code, const string& text)
 {
-    handler->client.close(code, text);
+    handler->proxy.close(code, text);
 }
 
 void ConnectionHandler::heartbeat()
 {
-    handler->client.heartbeat();
+    handler->proxy.heartbeat();
 }
 
 void ConnectionHandler::handle(framing::AMQFrame& frame)
 {
     AMQMethodBody* method=frame.getBody()->getMethod();
     try{
-        bool handled = false;
-        if (handler->serverMode) {
-            handled = invoke(static_cast<AMQP_ServerOperations::ConnectionHandler&>(*handler.get()), *method);
-        } else {
-            handled = invoke(static_cast<AMQP_ClientOperations::ConnectionHandler&>(*handler.get()), *method);
-        }
-        if (!handled) {
+        if (!invoke(static_cast<AMQP_AllOperations::ConnectionHandler&>(*handler.get()), *method)) {
             handler->connection.getChannel(frame.getChannel()).in(frame);
         }
-
     }catch(ConnectionException& e){
-        handler->client.close(e.code, e.what());
+        handler->proxy.close(e.code, e.what());
     }catch(std::exception& e){
-        handler->client.close(541/*internal error*/, e.what());
+        handler->proxy.close(541/*internal error*/, e.what());
     }
 }
 
@@ -91,7 +83,7 @@
 ConnectionHandler::ConnectionHandler(Connection& connection, bool isClient)  : handler(new Handler(connection, isClient)) {}
 
 ConnectionHandler::Handler::Handler(Connection& c, bool isClient) :
-    client(c.getOutput()), server(c.getOutput()),
+    proxy(c.getOutput()),
     connection(c), serverMode(!isClient), acl(0), secured(0)
 {
     if (serverMode) {
@@ -109,7 +101,7 @@
         Array locales(0x95);
         boost::shared_ptr<FieldValue> l(new Str16Value(en_US));
         locales.add(l);
-        client.start(properties, mechanisms, locales);
+        proxy.start(properties, mechanisms, locales);
     }
 }
 
@@ -139,7 +131,7 @@
     connection.setFederationPeerTag(clientProperties.getAsString(QPID_FED_TAG));
     if (connection.isFederationLink()) {
     	if (acl && !acl->authorise(connection.getUserId(),acl::ACT_CREATE,acl::OBJ_LINK,"")){
-            client.close(framing::connection::CLOSE_CODE_CONNECTION_FORCED,"ACL denied creating a federation link");
+            proxy.close(framing::connection::CLOSE_CODE_CONNECTION_FORCED,"ACL denied creating a federation link");
             return;
         }
         QPID_LOG(info, "Connection is a federation link");
@@ -193,7 +185,7 @@
     framing::Array array(0x95); // str16 array
     for (std::vector<Url>::iterator i = urls.begin(); i < urls.end(); ++i) 
         array.add(boost::shared_ptr<Str16Value>(new Str16Value(i->str())));
-    client.openOk(array);
+    proxy.openOk(array);
 
     //install security layer if one has been negotiated:
     if (secured) {
@@ -212,7 +204,7 @@
     if (replyCode == framing::connection::CLOSE_CODE_CONNECTION_FORCED)
         connection.notifyConnectionForced(replyText);
 
-    client.closeOk();
+    proxy.closeOk();
     connection.getOutput().close();
 } 
         
@@ -238,12 +230,12 @@
     FieldTable ft;
     ft.setInt(QPID_FED_LINK,1);
     ft.setString(QPID_FED_TAG, connection.getBroker().getFederationTag());
-    server.startOk(ft, mechanism, response, en_US);
+    proxy.startOk(ft, mechanism, response, en_US);
 }
 
 void ConnectionHandler::Handler::secure(const string& /*challenge*/)
 {
-    server.secureOk("");
+    proxy.secureOk("");
 }
 
 void ConnectionHandler::Handler::tune(uint16_t channelMax,
@@ -253,8 +245,8 @@
 {
     connection.setFrameMax(frameMax);
     connection.setHeartbeat(heartbeatMax);
-    server.tuneOk(channelMax, frameMax, heartbeatMax);
-    server.open("/", Array(), true);
+    proxy.tuneOk(channelMax, frameMax, heartbeatMax);
+    proxy.open("/", Array(), true);
 }
 
 void ConnectionHandler::Handler::openOk(const framing::Array& knownHosts)

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.h?rev=752897&r1=752896&r2=752897&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/ConnectionHandler.h Thu Mar 12 15:28:02 2009
@@ -25,10 +25,8 @@
 #include "SaslAuthenticator.h"
 #include "qpid/framing/amqp_types.h"
 #include "qpid/framing/AMQFrame.h"
-#include "qpid/framing/AMQP_ClientOperations.h"
-#include "qpid/framing/AMQP_ClientProxy.h"
-#include "qpid/framing/AMQP_ServerOperations.h"
-#include "qpid/framing/AMQP_ServerProxy.h"
+#include "qpid/framing/AMQP_AllOperations.h"
+#include "qpid/framing/AMQP_AllProxy.h"
 #include "qpid/framing/enum.h"
 #include "qpid/framing/FrameHandler.h"
 #include "qpid/framing/ProtocolInitiation.h"
@@ -44,11 +42,9 @@
 
 class ConnectionHandler : public framing::FrameHandler
 {
-    struct Handler : public framing::AMQP_ServerOperations::ConnectionHandler, 
-        public framing::AMQP_ClientOperations::ConnectionHandler
+    struct Handler : public framing::AMQP_AllOperations::ConnectionHandler
     {
-        framing::AMQP_ClientProxy::Connection client;
-        framing::AMQP_ServerProxy::Connection server;
+        framing::AMQP_AllProxy::Connection proxy;
         Connection& connection;
         bool serverMode;
         std::auto_ptr<SaslAuthenticator> authenticator;



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org