qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [26/41] qpid-proton git commit: PROTON-1857: [cpp] return *remote* offered/desired capabilities.
Date Wed, 04 Jul 2018 15:57:58 GMT
PROTON-1857: [cpp] return *remote* offered/desired capabilities.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d15cbd84
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d15cbd84
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d15cbd84

Branch: refs/heads/go1
Commit: d15cbd84c1c168c90591f64fe40d59057afa2a78
Parents: 563c9ee
Author: Alan Conway <aconway@redhat.com>
Authored: Wed Jun 13 13:22:10 2018 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Wed Jun 13 13:22:10 2018 -0400

----------------------------------------------------------------------
 cpp/src/connection.cpp     |  4 ++--
 cpp/src/container_test.cpp | 14 +++++++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d15cbd84/cpp/src/connection.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connection.cpp b/cpp/src/connection.cpp
index 610beee..cab1ec6 100644
--- a/cpp/src/connection.cpp
+++ b/cpp/src/connection.cpp
@@ -181,12 +181,12 @@ void connection::wake() const {
 }
 
 std::vector<symbol> connection::offered_capabilities() const {
-    value caps(pn_connection_offered_capabilities(pn_object()));
+    value caps(pn_connection_remote_offered_capabilities(pn_object()));
     return caps.empty() ? std::vector<symbol>() : caps.get<std::vector<symbol>
>();
 }
 
 std::vector<symbol> connection::desired_capabilities() const {
-    value caps(pn_connection_desired_capabilities(pn_object()));
+    value caps(pn_connection_remote_desired_capabilities(pn_object()));
     return caps.empty() ? std::vector<symbol>() : caps.get<std::vector<symbol>
>();
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d15cbd84/cpp/src/container_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/container_test.cpp b/cpp/src/container_test.cpp
index f73f95b..eb79f30 100644
--- a/cpp/src/container_test.cpp
+++ b/cpp/src/container_test.cpp
@@ -105,13 +105,15 @@ class test_handler : public proton::messaging_handler {
         ASSERT(listen_handler.on_open_);
         ASSERT(!listen_handler.on_close_);
         ASSERT(listen_handler.on_error_.empty());
-        if (peer_vhost.empty() && !c.virtual_host().empty())
+        // First call is the incoming server-side of the connection, that we are interested
in.
+        // Second call is for the response to the client, ignore that.
+        if (!closing) {
             peer_vhost = c.virtual_host();
-        if (peer_container_id.empty() && !c.container_id().empty())
             peer_container_id = c.container_id();
-        peer_offered_capabilities = c.offered_capabilities();
-        peer_desired_capabilities = c.desired_capabilities();
-        if (!closing) c.close();
+            peer_offered_capabilities = c.offered_capabilities();
+            peer_desired_capabilities = c.desired_capabilities();
+            c.close();
+        }
         closing = true;
     }
 
@@ -173,7 +175,9 @@ int test_container_capabilities() {
     opts.desired_capabilities(make_caps("desired"));
     test_handler th("", opts);
     proton::container(th).run();
+    ASSERT_EQUAL(th.peer_offered_capabilities.size(), 1);
     ASSERT_EQUAL(th.peer_offered_capabilities[0], proton::symbol("offered"));
+    ASSERT_EQUAL(th.peer_desired_capabilities.size(), 1);
     ASSERT_EQUAL(th.peer_desired_capabilities[0], proton::symbol("desired"));
     return 0;
 }


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


Mime
View raw message