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/12 16:51:57 UTC
[2/2] qpid-proton git commit: PROTON-1196: [C++ bindings] Move
connection option accessors from transport to connection
PROTON-1196: [C++ bindings] Move connection option accessors from transport to 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/be69853b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/be69853b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/be69853b
Branch: refs/heads/master
Commit: be69853b95274740b106600b3bd257c7f488aec4
Parents: abce0e6
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu May 12 17:11:09 2016 +0100
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu May 12 17:48:11 2016 +0100
----------------------------------------------------------------------
examples/cpp/connection_options.cpp | 4 +--
.../bindings/cpp/include/proton/connection.hpp | 4 +++
.../bindings/cpp/include/proton/transport.hpp | 12 -------
proton-c/bindings/cpp/src/connection.cpp | 12 +++++++
proton-c/bindings/cpp/src/connector.cpp | 4 +--
.../bindings/cpp/src/io/connection_engine.cpp | 4 +--
proton-c/bindings/cpp/src/transport.cpp | 34 --------------------
7 files changed, 22 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/be69853b/examples/cpp/connection_options.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/connection_options.cpp b/examples/cpp/connection_options.cpp
index f637d94..8131307 100644
--- a/examples/cpp/connection_options.cpp
+++ b/examples/cpp/connection_options.cpp
@@ -34,8 +34,8 @@ using proton::connection_options;
class handler_2 : public proton::handler {
void on_connection_open(proton::connection &c) override {
std::cout << "connection events going to handler_2" << std::endl;
- std::cout << "connection max_frame_size: " << c.transport().max_frame_size() <<
- ", idle timeout: " << c.transport().idle_timeout() << std::endl;
+ std::cout << "connection max_frame_size: " << c.max_frame_size() <<
+ ", idle timeout: " << c.idle_timeout() << std::endl;
c.close();
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/be69853b/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 bf03a34..3864c22 100644
--- a/proton-c/bindings/cpp/include/proton/connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/connection.hpp
@@ -108,6 +108,10 @@ PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, publi
/// Return sessions on this connection matching the state mask.
PN_CPP_EXTERN session_range sessions() 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;
/// @cond INTERNAL
private:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/be69853b/proton-c/bindings/cpp/include/proton/transport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/transport.hpp b/proton-c/bindings/cpp/include/proton/transport.hpp
index 590bac0..84b6832 100644
--- a/proton-c/bindings/cpp/include/proton/transport.hpp
+++ b/proton-c/bindings/cpp/include/proton/transport.hpp
@@ -59,18 +59,6 @@ class transport : public internal::object<pn_transport_t> {
PN_CPP_EXTERN class error_condition error() const;
/// @cond INTERNAL
- /// XXX need to discuss, local versus remote
- PN_CPP_EXTERN void unbind();
- PN_CPP_EXTERN void bind(class connection &);
- PN_CPP_EXTERN uint32_t max_frame_size() const;
- PN_CPP_EXTERN uint32_t remote_max_frame_size() const;
- PN_CPP_EXTERN uint16_t max_channels() const;
- PN_CPP_EXTERN uint16_t remote_max_channels() const;
- PN_CPP_EXTERN uint32_t idle_timeout() const;
- PN_CPP_EXTERN uint32_t remote_idle_timeout() const;
- /// @endcond
-
- /// @cond INTERNAL
friend class internal::factory<transport>;
/// @endcond
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/be69853b/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 f6202f0..f7f335d 100644
--- a/proton-c/bindings/cpp/src/connection.cpp
+++ b/proton-c/bindings/cpp/src/connection.cpp
@@ -126,6 +126,18 @@ error_condition connection::error() const {
return make_wrapper(pn_connection_remote_condition(pn_object()));
}
+uint32_t connection::max_frame_size() const {
+ return pn_transport_get_remote_max_frame(pn_connection_transport(pn_object()));
+}
+
+uint16_t connection::max_sessions() const {
+ return pn_transport_remote_channel_max(pn_connection_transport(pn_object()));
+}
+
+uint32_t connection::idle_timeout() const {
+ return pn_transport_get_remote_idle_timeout(pn_connection_transport(pn_object()));
+}
+
void connection::user(const std::string &name) { pn_connection_set_user(pn_object(), name.c_str()); }
void connection::password(const std::string &pass) { pn_connection_set_password(pn_object(), pass.c_str()); }
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/be69853b/proton-c/bindings/cpp/src/connector.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connector.cpp b/proton-c/bindings/cpp/src/connector.cpp
index dbf74be..0bec024 100644
--- a/proton-c/bindings/cpp/src/connector.cpp
+++ b/proton-c/bindings/cpp/src/connector.cpp
@@ -63,7 +63,7 @@ void connector::connect() {
connection_.user(address_.user());
if (!address_.password().empty())
connection_.password(address_.password());
- t.bind(connection_);
+ pn_transport_bind(pnt, unwrap(connection_));
pn_decref(pnt);
// Apply options to the new transport.
options_.apply(connection_);
@@ -91,7 +91,7 @@ void connector::on_transport_closed(proton_event &) {
if (!connection_) return;
if (connection_.active()) {
if (reconnect_timer_) {
- connection_.transport().unbind();
+ pn_transport_unbind(unwrap(connection_.transport()));
transport_configured_ = false;
int delay = reconnect_timer_->next_delay(timestamp::now());
if (delay >= 0) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/be69853b/proton-c/bindings/cpp/src/io/connection_engine.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/io/connection_engine.cpp b/proton-c/bindings/cpp/src/io/connection_engine.cpp
index 3865953..b7bb343 100644
--- a/proton-c/bindings/cpp/src/io/connection_engine.cpp
+++ b/proton-c/bindings/cpp/src/io/connection_engine.cpp
@@ -50,7 +50,7 @@ connection_engine::connection_engine(class handler &h, const connection_options&
{
if (!connection_ || !transport_ || !collector_)
throw proton::error("engine create");
- transport_.bind(connection_);
+ pn_transport_bind(unwrap(transport_), unwrap(connection_));
pn_connection_collect(unwrap(connection_), collector_.get());
opts.apply(connection_);
@@ -64,7 +64,7 @@ connection_engine::connection_engine(class handler &h, const connection_options&
}
connection_engine::~connection_engine() {
- transport_.unbind();
+ pn_transport_unbind(unwrap(transport_));
pn_collector_free(collector_.release()); // Break cycle with connection_
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/be69853b/proton-c/bindings/cpp/src/transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/transport.cpp b/proton-c/bindings/cpp/src/transport.cpp
index b22d09a..e6217ae 100644
--- a/proton-c/bindings/cpp/src/transport.cpp
+++ b/proton-c/bindings/cpp/src/transport.cpp
@@ -50,38 +50,4 @@ error_condition transport::error() const {
return make_wrapper(pn_transport_condition(pn_object()));
}
-void transport::unbind() {
- if (pn_transport_unbind(pn_object()))
- throw proton::error(MSG("transport::unbind failed " << pn_error_text(pn_transport_error(pn_object()))));
-}
-
-void transport::bind(class connection &conn) {
- if (pn_transport_bind(pn_object(), unwrap(conn)))
- throw proton::error(MSG("transport::bind failed " << pn_error_text(pn_transport_error(pn_object()))));
-}
-
-uint32_t transport::max_frame_size() const {
- return pn_transport_get_max_frame(pn_object());
-}
-
-uint32_t transport::remote_max_frame_size() const {
- return pn_transport_get_remote_max_frame(pn_object());
-}
-
-uint16_t transport::max_channels() const {
- return pn_transport_get_channel_max(pn_object());
-}
-
-uint16_t transport::remote_max_channels() const {
- return pn_transport_remote_channel_max(pn_object());
-}
-
-uint32_t transport::idle_timeout() const {
- return pn_transport_get_idle_timeout(pn_object());
-}
-
-uint32_t transport::remote_idle_timeout() const {
- return pn_transport_get_remote_idle_timeout(pn_object());
-}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org