You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/04/27 00:18:36 UTC

[1/4] qpid-proton git commit: PROTON-1182: [C++ binding] Fix dummy receiver_option::selector

Repository: qpid-proton
Updated Branches:
  refs/heads/master 74eed448a -> bfb5d19d4


PROTON-1182: [C++ binding] Fix dummy receiver_option::selector


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

Branch: refs/heads/master
Commit: 5c24f894ecb7e1834a0402f2a7dfe8fb33f61d23
Parents: 74eed44
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Apr 26 18:15:03 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Apr 26 18:15:03 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/include/proton/receiver_options.hpp | 2 +-
 proton-c/bindings/cpp/src/receiver_options.cpp            | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c24f894/proton-c/bindings/cpp/include/proton/receiver_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/receiver_options.hpp b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
index 592e4ab..b0bf02a 100644
--- a/proton-c/bindings/cpp/include/proton/receiver_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
@@ -94,7 +94,7 @@ class receiver_options {
     /// Set a selector on the receiver to str.  This sets a single
     /// registered filter on the link of type
     /// apache.org:selector-filter with value str.
-    PN_CPP_EXTERN receiver_options& selector(const std::string&){return *this;};
+    PN_CPP_EXTERN receiver_options& selector(const std::string&);
     /// @endcond
 
     /// Automatically accept inbound messages that aren't otherwise

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c24f894/proton-c/bindings/cpp/src/receiver_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/receiver_options.cpp b/proton-c/bindings/cpp/src/receiver_options.cpp
index 5abb5f6..3e737fd 100644
--- a/proton-c/bindings/cpp/src/receiver_options.cpp
+++ b/proton-c/bindings/cpp/src/receiver_options.cpp
@@ -127,6 +127,7 @@ receiver_options& receiver_options::auto_settle(bool b) {impl_->auto_settle = b;
 receiver_options& receiver_options::credit_window(int w) {impl_->credit_window = w; return *this; }
 receiver_options& receiver_options::source(source_options &s) {impl_->source = s; return *this; }
 receiver_options& receiver_options::target(target_options &s) {impl_->target = s; return *this; }
+receiver_options& receiver_options::selector(const std::string&) { return *this; }
 
 void receiver_options::apply(receiver& r) const { impl_->apply(r); }
 proton_handler* receiver_options::handler() const { return impl_->handler.value; }


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


[4/4] qpid-proton git commit: PROTON-1182: [C++ binding] Tidy up and fix link iterators

Posted by as...@apache.org.
PROTON-1182: [C++ binding] Tidy up and fix link iterators


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

Branch: refs/heads/master
Commit: 52338b8c9b44e07464c28b47371b69cc40acdaaf
Parents: 5f5ae93
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Apr 26 15:08:34 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Apr 26 18:16:09 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/include/proton/receiver.hpp | 12 +++++++++---
 proton-c/bindings/cpp/include/proton/sender.hpp   | 12 +++++++++---
 proton-c/bindings/cpp/src/session.cpp             |  5 +++--
 3 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/52338b8c/proton-c/bindings/cpp/include/proton/receiver.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/receiver.hpp b/proton-c/bindings/cpp/include/proton/receiver.hpp
index be47481..d0eb6ec 100644
--- a/proton-c/bindings/cpp/include/proton/receiver.hpp
+++ b/proton-c/bindings/cpp/include/proton/receiver.hpp
@@ -63,16 +63,22 @@ PN_CPP_CLASS_EXTERN receiver : public internal::link {
 };
 
 class receiver_iterator : public internal::iter_base<receiver, receiver_iterator> {
-  public:
     ///@cond INTERNAL
-    explicit receiver_iterator(receiver r = 0, pn_session_t* s = 0) :
-        internal::iter_base<receiver, receiver_iterator>(r), session_(s) {}
+    explicit receiver_iterator(receiver r, pn_session_t* s = 0) :
+        iter_base<receiver, receiver_iterator>(r), session_(s) {}
     ///@endcond
+
+  public:
+    explicit receiver_iterator() :
+        iter_base<receiver, receiver_iterator>(0), session_(0) {}
     /// Advance
     PN_CPP_EXTERN receiver_iterator operator++();
 
   private:
     pn_session_t* session_;
+
+    friend class connection;
+    friend class session;
 };
 
 /// A range of receivers.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/52338b8c/proton-c/bindings/cpp/include/proton/sender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/sender.hpp b/proton-c/bindings/cpp/include/proton/sender.hpp
index 87b9697..6f13abe 100644
--- a/proton-c/bindings/cpp/include/proton/sender.hpp
+++ b/proton-c/bindings/cpp/include/proton/sender.hpp
@@ -71,16 +71,22 @@ PN_CPP_CLASS_EXTERN sender : public internal::link
 };
 
 class sender_iterator : public internal::iter_base<sender, sender_iterator> {
-  public:
     ///@cond INTERNAL
-    explicit sender_iterator(sender snd = 0, pn_session_t* s = 0) :
-        internal::iter_base<sender, sender_iterator>(snd), session_(s) {}
+    sender_iterator(sender snd, pn_session_t* s = 0) :
+        iter_base<sender, sender_iterator>(snd), session_(s) {}
     ///@endcond
+
+  public:
+    sender_iterator() :
+        iter_base<sender, sender_iterator>(0), session_(0) {}
     /// Advance
     PN_CPP_EXTERN sender_iterator operator++();
 
   private:
     pn_session_t* session_;
+
+    friend class connection;
+    friend class session;
 };
 
 /// A range of senders.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/52338b8c/proton-c/bindings/cpp/src/session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/session.cpp b/proton-c/bindings/cpp/src/session.cpp
index 6e34ec6..42384dd 100644
--- a/proton-c/bindings/cpp/src/session.cpp
+++ b/proton-c/bindings/cpp/src/session.cpp
@@ -83,7 +83,7 @@ sender_range session::senders() const {
             break;
         lnk = pn_link_next(lnk, 0);
     }
-    return sender_range(sender_iterator(lnk));
+    return sender_range(sender_iterator(lnk, pn_object()));
 }
 
 receiver_range session::receivers() const {
@@ -91,8 +91,9 @@ receiver_range session::receivers() const {
     while (lnk) {
         if (pn_link_is_receiver(lnk) && pn_link_session(lnk) == pn_object())
             break;
+        lnk = pn_link_next(lnk, 0);
     }
-    return receiver_range(receiver_iterator(lnk));
+    return receiver_range(receiver_iterator(lnk, pn_object()));
 }
 
 


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


[3/4] qpid-proton git commit: PROTON-1182: [C++ binding] Change engine tests to use senders/receivers where appropriate

Posted by as...@apache.org.
PROTON-1182: [C++ binding] Change engine tests to use senders/receivers where appropriate


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

Branch: refs/heads/master
Commit: bfb5d19d46c2a4a24ffd9d697e4a1b76d2273c1f
Parents: 52338b8
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Apr 26 16:21:30 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Apr 26 18:16:09 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/engine_test.cpp | 50 +++++++++++++-------------
 1 file changed, 26 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bfb5d19d/proton-c/bindings/cpp/src/engine_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/engine_test.cpp b/proton-c/bindings/cpp/src/engine_test.cpp
index 571bebd..d94abdc 100644
--- a/proton-c/bindings/cpp/src/engine_test.cpp
+++ b/proton-c/bindings/cpp/src/engine_test.cpp
@@ -95,16 +95,17 @@ template <class S> typename S::value_type quick_pop(S& s) {
 
 /// A handler that records incoming endpoints, errors etc.
 struct record_handler : public handler {
-    std::deque<proton::internal::link> links;
+    std::deque<proton::receiver> receivers;
+    std::deque<proton::sender> senders;
     std::deque<proton::session> sessions;
     std::deque<std::string> unhandled_errors, transport_errors, connection_errors;
 
     void on_receiver_open(receiver &l) override {
-        links.push_back(l);
+        receivers.push_back(l);
     }
 
     void on_sender_open(sender &l) override {
-        links.push_back(l);
+        senders.push_back(l);
     }
 
     void on_session_open(session &s) override {
@@ -136,19 +137,19 @@ void test_engine_prefix() {
     ASSERT_EQUAL("b", e.b.connection().container_id());
 
     e.a.connection().open_sender("x");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("x/1", quick_pop(ha.links).name());
-    ASSERT_EQUAL("x/1", quick_pop(hb.links).name());
+    while (ha.senders.empty() || hb.receivers.empty()) e.process();
+    ASSERT_EQUAL("x/1", quick_pop(ha.senders).name());
+    ASSERT_EQUAL("x/1", quick_pop(hb.receivers).name());
 
     e.a.connection().open_receiver("");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("x/2", quick_pop(ha.links).name());
-    ASSERT_EQUAL("x/2", quick_pop(hb.links).name());
+    while (ha.receivers.empty() || hb.senders.empty()) e.process();
+    ASSERT_EQUAL("x/2", quick_pop(ha.receivers).name());
+    ASSERT_EQUAL("x/2", quick_pop(hb.senders).name());
 
     e.b.connection().open_receiver("");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("y/1", quick_pop(ha.links).name());
-    ASSERT_EQUAL("y/1", quick_pop(hb.links).name());
+    while (ha.senders.empty() || hb.receivers.empty()) e.process();
+    ASSERT_EQUAL("y/1", quick_pop(ha.senders).name());
+    ASSERT_EQUAL("y/1", quick_pop(hb.receivers).name());
 }
 
 void test_container_prefix() {
@@ -164,15 +165,15 @@ void test_container_prefix() {
     sender s = e.a.connection().open_sender("x");
     ASSERT_EQUAL("1/1", s.name());
 
-    while (ha.links.empty() || hb.links.empty()) e.process();
+    while (ha.senders.empty() || hb.receivers.empty()) e.process();
 
-    ASSERT_EQUAL("1/1", quick_pop(ha.links).name());
-    ASSERT_EQUAL("1/1", quick_pop(hb.links).name());
+    ASSERT_EQUAL("1/1", quick_pop(ha.senders).name());
+    ASSERT_EQUAL("1/1", quick_pop(hb.receivers).name());
 
     e.a.connection().open_receiver("y");
-    while (ha.links.empty() || hb.links.empty()) e.process();
-    ASSERT_EQUAL("1/2", quick_pop(ha.links).name());
-    ASSERT_EQUAL("1/2", quick_pop(hb.links).name());
+    while (ha.receivers.empty() || hb.senders.empty()) e.process();
+    ASSERT_EQUAL("1/2", quick_pop(ha.receivers).name());
+    ASSERT_EQUAL("1/2", quick_pop(hb.senders).name());
 
     // Open a second connection in each container, make sure links have different IDs.
     record_handler ha2, hb2;
@@ -185,10 +186,10 @@ void test_container_prefix() {
     receiver r = e2.b.connection().open_receiver("z");
     ASSERT_EQUAL("2/1", r.name());
 
-    while (ha2.links.empty() || hb2.links.empty()) e2.process();
+    while (ha2.senders.empty() || hb2.receivers.empty()) e2.process();
 
-    ASSERT_EQUAL("2/1", quick_pop(ha2.links).name());
-    ASSERT_EQUAL("2/1", quick_pop(hb2.links).name());
+    ASSERT_EQUAL("2/1", quick_pop(ha2.senders).name());
+    ASSERT_EQUAL("2/1", quick_pop(hb2.receivers).name());
 };
 
 void test_endpoint_close() {
@@ -199,9 +200,10 @@ void test_endpoint_close() {
     e.a.connection().open();
     e.a.connection().open_sender("x");
     e.a.connection().open_receiver("y");
-    while (ha.links.size() < 2 || hb.links.size() < 2) e.process();
-    proton::internal::link ax = quick_pop(ha.links), ay = quick_pop(ha.links);
-    proton::internal::link bx = quick_pop(hb.links), by = quick_pop(hb.links);
+    while (ha.senders.size()+ha.receivers.size() < 2 ||
+           hb.senders.size()+hb.receivers.size() < 2) e.process();
+    proton::internal::link ax = quick_pop(ha.senders), ay = quick_pop(ha.receivers);
+    proton::internal::link bx = quick_pop(hb.receivers), by = quick_pop(hb.senders);
 
     // Close a link
     ax.close(proton::error_condition("err", "foo bar"));


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


[2/4] qpid-proton git commit: PROTON-1182: [C++ binding] Remove now unneeded sender & receiver members of link

Posted by as...@apache.org.
PROTON-1182: [C++ binding] Remove now unneeded sender & receiver members of link


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

Branch: refs/heads/master
Commit: 5f5ae932ac0362bd592bc270194153a514b8a9f5
Parents: 5c24f89
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Apr 26 01:21:30 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Apr 26 18:16:09 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/include/proton/link.hpp   | 12 ------------
 proton-c/bindings/cpp/src/link.cpp              | 16 ----------------
 proton-c/bindings/cpp/src/messaging_adapter.cpp |  8 ++++----
 3 files changed, 4 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5f5ae932/proton-c/bindings/cpp/include/proton/link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/link.hpp b/proton-c/bindings/cpp/include/proton/link.hpp
index 515787c..9af4523 100644
--- a/proton-c/bindings/cpp/include/proton/link.hpp
+++ b/proton-c/bindings/cpp/include/proton/link.hpp
@@ -86,18 +86,6 @@ PN_CPP_CLASS_EXTERN link : public object<pn_link_t> , public endpoint {
     /// without cancelling it.
     PN_CPP_EXTERN void detach();
 
-    /// Return sender if this link is a sender, 0 if not.
-    PN_CPP_EXTERN class sender sender();
-
-    /// Return sender if this link is a sender, 0 if not.
-    PN_CPP_EXTERN const class sender sender() const;
-
-    /// Return receiver if this link is a receiver, 0 if not.
-    PN_CPP_EXTERN class receiver receiver();
-
-    /// Return receiver if this link is a receiver, 0 if not.
-    PN_CPP_EXTERN const class receiver receiver() const;
-
     /// Credit available on the link.
     PN_CPP_EXTERN int credit() const;
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5f5ae932/proton-c/bindings/cpp/src/link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/link.cpp b/proton-c/bindings/cpp/src/link.cpp
index d12bd5a..de431d5 100644
--- a/proton-c/bindings/cpp/src/link.cpp
+++ b/proton-c/bindings/cpp/src/link.cpp
@@ -45,22 +45,6 @@ void link::detach() {
     pn_link_detach(pn_object());
 }
 
-sender link::sender() {
-    return pn_link_is_sender(pn_object()) ? proton::sender(pn_object()) : proton::sender();
-}
-
-receiver link::receiver() {
-    return pn_link_is_receiver(pn_object()) ? proton::receiver(pn_object()) : proton::receiver();
-}
-
-const sender link::sender() const {
-    return pn_link_is_sender(pn_object()) ? proton::sender(pn_object()) : proton::sender();
-}
-
-const receiver link::receiver() const {
-    return pn_link_is_receiver(pn_object()) ? proton::receiver(pn_object()) : proton::receiver();
-}
-
 int link::credit() const {
     return pn_link_credit(pn_object());
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5f5ae932/proton-c/bindings/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp
index 83f737b..1981726 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -145,13 +145,13 @@ void messaging_adapter::on_link_remote_close(proton_event &pe) {
     pn_event_t *cevent = pe.pn_event();
     pn_link_t *lnk = pn_event_link(cevent);
     if (pn_link_is_receiver(lnk)) {
-        receiver r = internal::link(lnk).receiver();
+        receiver r(lnk);
         if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
             delegate_.on_receiver_error(r);
         }
         delegate_.on_receiver_close(r);
     } else {
-        sender s = internal::link(lnk).sender();
+        sender s(lnk);
         if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
             delegate_.on_sender_error(s);
         }
@@ -209,10 +209,10 @@ void messaging_adapter::on_link_remote_open(proton_event &pe) {
     sender s;
     pn_link_t *lnk = pn_event_link(pe.pn_event());
     if (pn_link_is_receiver(lnk)) {
-      r = internal::link(lnk).receiver();
+      r = lnk;
       delegate_.on_receiver_open(r);
     } else {
-      s = internal::link(lnk).sender();
+      s = lnk;
       delegate_.on_sender_open(s);
     }
     if (!is_local_open(pn_link_state(lnk)) && is_local_unititialised(pn_link_state(lnk))) {


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