PROTON-1679: [c++] terminus properties are not echoed to returning open

On receiving a link-open, a server should (by default) echo back the same set
of source/target properties that it received. The on_..._open() callback can 
modify
those properties as desired.

This is a behaviour of the python client that got dropped in the port to C++.


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

Branch: refs/heads/go1
Commit: 9364588c43b32f87482a1aff5e5ea371af815710
Parents: 27f9aec
Author: Alan Conway <acon...@redhat.com>
Authored: Thu Jun 14 14:31:27 2018 -0400
Committer: Alan Conway <acon...@redhat.com>
Committed: Thu Jun 14 15:27:40 2018 -0400

----------------------------------------------------------------------
 cpp/src/connection_driver_test.cpp | 10 ++++------
 cpp/src/messaging_adapter.cpp      |  5 +++++
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9364588c/cpp/src/connection_driver_test.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/connection_driver_test.cpp 
b/cpp/src/connection_driver_test.cpp
index 9c385ee..5a4bfcb 100644
--- a/cpp/src/connection_driver_test.cpp
+++ b/cpp/src/connection_driver_test.cpp
@@ -358,15 +358,13 @@ void test_link_options() {
 
     proton::sender ax = quick_pop(ha.senders);
     ASSERT_EQUAL("_x", ax.name());
-    // TODO PROTON-1679 - the following assertion should pass.
-    // ASSERT_EQUAL("x", ax.target().address());
-    // ASSERT_EQUAL(many<proton::symbol>() + "foo" + "bar", 
ax.target().capabilities());
+    ASSERT_EQUAL("x", ax.target().address());
+    ASSERT_EQUAL(many<proton::symbol>() + "foo" + "bar", 
ax.target().capabilities());
 
     proton::receiver ay = quick_pop(ha.receivers);
     ASSERT_EQUAL("_y", ay.name());
-    // TODO PROTON-1679 - the following assertion should pass.
-    // ASSERT_EQUAL("y", ay.source().address());
-    // ASSERT_EQUAL(many<proton::symbol>() + "foo" + "bar", 
ay.source().capabilities());
+    ASSERT_EQUAL("y", ay.source().address());
+    ASSERT_EQUAL(many<proton::symbol>() + "foo" + "bar", 
ay.source().capabilities());
 
     proton::receiver bx = quick_pop(hb.receivers);
     ASSERT_EQUAL("x", bx.target().address());

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9364588c/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/cpp/src/messaging_adapter.cpp b/cpp/src/messaging_adapter.cpp
index 7895aa7..e01f29f 100644
--- a/cpp/src/messaging_adapter.cpp
+++ b/cpp/src/messaging_adapter.cpp
@@ -258,6 +258,11 @@ void on_link_local_open(messaging_handler& handler, 
pn_event_t* event) {
 
 void on_link_remote_open(messaging_handler& handler, pn_event_t* event) {
     pn_link_t *lnk = pn_event_link(event);
+    if (pn_link_state(lnk) & PN_LOCAL_UNINIT) { // Incoming link
+        // Copy source and target from remote end.
+        pn_terminus_copy(pn_link_source(lnk), pn_link_remote_source(lnk));
+        pn_terminus_copy(pn_link_target(lnk), pn_link_remote_target(lnk));
+    }
     if (pn_link_is_receiver(lnk)) {
       receiver r(make_wrapper<receiver>(lnk));
       handler.on_receiver_open(r);


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

Reply via email to