qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1485658 - in /qpid/trunk/qpid/cpp/src/qpid/broker/amqp: Session.cpp Session.h
Date Thu, 23 May 2013 12:19:12 GMT
Author: gsim
Date: Thu May 23 12:19:12 2013
New Revision: 1485658

URL: http://svn.apache.org/r1485658
Log:
QPID-4880: Qualify the name passed back to the client for dynamically created nodes with the
brokers domain

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp?rev=1485658&r1=1485657&r2=1485658&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp Thu May 23 12:19:12 2013
@@ -171,12 +171,20 @@ std::string Session::generateName(pn_lin
 {
     std::stringstream s;
     s << qpid::types::Uuid(true) << "::" << pn_link_name(link);
-    if (!connection.getDomain().empty()) {
-        s << "@" << connection.getDomain();
-    }
     return s.str();
 }
 
+std::string Session::qualifyName(const std::string& name)
+{
+    if (connection.getDomain().empty()) {
+        return name;
+    } else {
+        std::stringstream s;
+        s << name << "@" << connection.getDomain();
+        return s.str();
+    }
+}
+
 void Session::attach(pn_link_t* link)
 {
     if (pn_link_is_sender(link)) {
@@ -187,11 +195,13 @@ void Session::attach(pn_link_t* link)
             throw qpid::Exception("No source specified!");/*invalid-field?*/
         } else if (pn_terminus_is_dynamic(source)) {
             name = generateName(link);
+            QPID_LOG(debug, "Received attach request for outgoing link from " << name);
+            pn_terminus_set_address(pn_link_source(link), qualifyName(name).c_str());
         } else {
             name = pn_terminus_get_address(source);
+            QPID_LOG(debug, "Received attach request for outgoing link from " << name);
+            pn_terminus_set_address(pn_link_source(link), name.c_str());
         }
-        QPID_LOG(debug, "Received attach request for outgoing link from " << name);
-        pn_terminus_set_address(pn_link_source(link), name.c_str());
 
         setupOutgoing(link, source, name);
     } else {
@@ -201,11 +211,13 @@ void Session::attach(pn_link_t* link)
             throw qpid::Exception("No target specified!");/*invalid field?*/
         } else if (pn_terminus_is_dynamic(target)) {
             name = generateName(link);
+            QPID_LOG(debug, "Received attach request for incoming link to " << name);
+            pn_terminus_set_address(pn_link_target(link), qualifyName(name).c_str());
         } else {
             name  = pn_terminus_get_address(target);
+            QPID_LOG(debug, "Received attach request for incoming link to " << name);
+            pn_terminus_set_address(pn_link_target(link), name.c_str());
         }
-        QPID_LOG(debug, "Received attach request for incoming link to " << name);
-        pn_terminus_set_address(pn_link_target(link), name.c_str());
 
         setupIncoming(link, target, name);
     }

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.h?rev=1485658&r1=1485657&r2=1485658&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.h Thu May 23 12:19:12 2013
@@ -96,6 +96,7 @@ class Session : public ManagedSession, p
     void setupOutgoing(pn_link_t* link, pn_terminus_t* source, const std::string& name);
     void setupIncoming(pn_link_t* link, pn_terminus_t* target, const std::string& name);
     std::string generateName(pn_link_t*);
+    std::string qualifyName(const std::string&);
 };
 }}} // namespace qpid::broker::amqp
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message