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/05/13 15:11:31 UTC
qpid-proton git commit: PROTON-1198: [C++ binding] senders/receivers
range accessors for connection
Repository: qpid-proton
Updated Branches:
refs/heads/master f6247e004 -> d05357726
PROTON-1198: [C++ binding] senders/receivers range accessors for connection
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d0535772
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d0535772
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d0535772
Branch: refs/heads/master
Commit: d05357726c5c6f1aadebfa59e30b4ae4ae4d545f
Parents: f6247e0
Author: Andrew Stitcher <as...@apache.org>
Authored: Fri May 13 16:08:07 2016 +0100
Committer: Andrew Stitcher <as...@apache.org>
Committed: Fri May 13 16:08:07 2016 +0100
----------------------------------------------------------------------
examples/cpp/broker.hpp | 11 ++++-------
.../bindings/cpp/include/proton/connection.hpp | 10 ++++++++--
proton-c/bindings/cpp/src/connection.cpp | 20 ++++++++++++++++++++
3 files changed, 32 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d0535772/examples/cpp/broker.hpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.hpp b/examples/cpp/broker.hpp
index 45a2e13..6eb45f9 100644
--- a/examples/cpp/broker.hpp
+++ b/examples/cpp/broker.hpp
@@ -210,13 +210,10 @@ class broker_handler : public proton::handler {
}
void remove_stale_consumers(proton::connection connection) {
- proton::session_range r1 = connection.sessions();
- for (proton::session_iterator i1 = r1.begin(); i1 != r1.end(); ++i1) {
- proton::sender_range r2 = i1->senders();
- for (proton::sender_iterator i2 = r2.begin(); i2 != r2.end(); ++i2) {
- if (i2->active())
- unsubscribe(*i2);
- }
+ proton::sender_range sr = connection.senders();
+ for (proton::sender_iterator i = sr.begin(); i != sr.end(); ++i) {
+ if (i->active())
+ unsubscribe(*i);
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d0535772/proton-c/bindings/cpp/include/proton/connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/connection.hpp b/proton-c/bindings/cpp/include/proton/connection.hpp
index 3864c22..fd7bffa 100644
--- a/proton-c/bindings/cpp/include/proton/connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/connection.hpp
@@ -106,9 +106,15 @@ PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, publi
PN_CPP_EXTERN receiver open_receiver(const std::string &addr,
const receiver_options &);
- /// Return sessions on this connection matching the state mask.
+ /// Return all sessions on this connection.
PN_CPP_EXTERN session_range sessions() const;
-
+
+ /// Return all receivers on this connection.
+ PN_CPP_EXTERN receiver_range receivers() const;
+
+ /// Return all senders on this connection.
+ PN_CPP_EXTERN sender_range senders() const;
+
PN_CPP_EXTERN uint32_t max_frame_size() const;
PN_CPP_EXTERN uint16_t max_sessions() const;
PN_CPP_EXTERN uint32_t idle_timeout() const;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d0535772/proton-c/bindings/cpp/src/connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection.cpp b/proton-c/bindings/cpp/src/connection.cpp
index 326aa26..175d495 100644
--- a/proton-c/bindings/cpp/src/connection.cpp
+++ b/proton-c/bindings/cpp/src/connection.cpp
@@ -82,6 +82,26 @@ session_range connection::sessions() const {
return session_range(session_iterator(make_wrapper(pn_session_head(pn_object(), 0))));
}
+receiver_range connection::receivers() const {
+ pn_link_t *lnk = pn_link_head(pn_object(), 0);
+ while (lnk) {
+ if (pn_link_is_receiver(lnk))
+ break;
+ lnk = pn_link_next(lnk, 0);
+ }
+ return receiver_range(receiver_iterator(make_wrapper<receiver>(lnk)));
+}
+
+sender_range connection::senders() const {
+ pn_link_t *lnk = pn_link_head(pn_object(), 0);
+ while (lnk) {
+ if (pn_link_is_sender(lnk))
+ break;
+ lnk = pn_link_next(lnk, 0);
+ }
+ return sender_range(sender_iterator(make_wrapper<sender>(lnk)));
+}
+
session connection::open_session() {
return open_session(session_options());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org