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 2017/09/12 20:52:57 UTC
qpid-proton git commit: PROTON-1570: [C++ binding] fix
connection_option processing - Previously SASL options (and others) were only
processed if they were specified as default options on a container
Repository: qpid-proton
Updated Branches:
refs/heads/master f719f80da -> 1d36257c9
PROTON-1570: [C++ binding] fix connection_option processing
- Previously SASL options (and others) were only processed if they
were specified as default options on a container
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1d36257c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1d36257c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1d36257c
Branch: refs/heads/master
Commit: 1d36257c9425d57f90c7e68db3e1932701ac530e
Parents: f719f80
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Sep 12 16:40:47 2017 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Sep 12 16:42:15 2017 -0400
----------------------------------------------------------------------
proton-c/bindings/cpp/src/connection_options.cpp | 10 +++++-----
proton-c/bindings/cpp/src/contexts.cpp | 5 ++---
proton-c/bindings/cpp/src/include/contexts.hpp | 4 ++--
proton-c/bindings/cpp/src/proactor_container_impl.cpp | 5 +++--
4 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d36257c/proton-c/bindings/cpp/src/connection_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection_options.cpp b/proton-c/bindings/cpp/src/connection_options.cpp
index ff97764..b522f9a 100644
--- a/proton-c/bindings/cpp/src/connection_options.cpp
+++ b/proton-c/bindings/cpp/src/connection_options.cpp
@@ -74,7 +74,7 @@ class connection_options::impl {
* transport options (set once per transport over the life of the
* connection).
*/
- void apply_unbound(connection& c, const connection_options& co) {
+ void apply_unbound(connection& c) {
pn_connection_t *pnc = unwrap(c);
// Only apply connection options if uninit.
@@ -82,7 +82,7 @@ class connection_options::impl {
if (!uninit) return;
if (reconnect.set)
- connection_context::get(pnc).reconnect_context_.reset(new reconnect_context(reconnect.value, co));
+ connection_context::get(pnc).reconnect_context_.reset(new reconnect_context(reconnect.value));
if (container_id.set)
pn_connection_set_container(pnc, container_id.value.c_str());
if (virtual_host.set)
@@ -116,10 +116,10 @@ class connection_options::impl {
throw error(MSG("server SSL/TLS initialization error"));
}
- // SASL
+ // SASL - skip entirely if explicitly disabled
if (!sasl_enabled.set || sasl_enabled.value) {
if (sasl_enabled.set) // Explicitly set, not just default behaviour.
- pn_sasl(pnt); // Force a sasl instance. Lazily create one otherwise.
+ pn_sasl(pnt); // Force a sasl instance. Lazily create one otherwise.
if (sasl_allow_insecure_mechs.set)
pn_sasl_set_allow_insecure_mechs(pn_sasl(pnt), sasl_allow_insecure_mechs.value);
if (sasl_allowed_mechs.set)
@@ -196,7 +196,7 @@ connection_options& connection_options::sasl_allowed_mechs(const std::string &s)
connection_options& connection_options::sasl_config_name(const std::string &n) { impl_->sasl_config_name = n; return *this; }
connection_options& connection_options::sasl_config_path(const std::string &p) { impl_->sasl_config_path = p; return *this; }
-void connection_options::apply_unbound(connection& c) const { impl_->apply_unbound(c, *this); }
+void connection_options::apply_unbound(connection& c) const { impl_->apply_unbound(c); }
void connection_options::apply_bound(connection& c) const { impl_->apply_bound(c); }
messaging_handler* connection_options::handler() const { return impl_->handler.value; }
} // namespace proton
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d36257c/proton-c/bindings/cpp/src/contexts.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.cpp b/proton-c/bindings/cpp/src/contexts.cpp
index d076478..bd5e80a 100644
--- a/proton-c/bindings/cpp/src/contexts.cpp
+++ b/proton-c/bindings/cpp/src/contexts.cpp
@@ -71,9 +71,8 @@ connection_context::connection_context() :
container(0), default_session(0), link_gen(0), handler(0), listener_context_(0)
{}
-reconnect_context::reconnect_context(const reconnect_options& ro, const connection_options& co) :
- reconnect_options_(new reconnect_options(ro)), connection_options_(new connection_options(co)),
- retries_(0), current_url_(-1)
+reconnect_context::reconnect_context(const reconnect_options& ro) :
+ reconnect_options_(new reconnect_options(ro)), retries_(0), current_url_(-1)
{}
listener_context::listener_context() : listen_handler_(0) {}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d36257c/proton-c/bindings/cpp/src/include/contexts.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/contexts.hpp b/proton-c/bindings/cpp/src/include/contexts.hpp
index 7797b08..4c5d679 100644
--- a/proton-c/bindings/cpp/src/include/contexts.hpp
+++ b/proton-c/bindings/cpp/src/include/contexts.hpp
@@ -92,6 +92,7 @@ class connection_context : public context {
messaging_handler* handler;
std::string connected_address_;
+ internal::pn_unique_ptr<connection_options> connection_options_;
internal::pn_unique_ptr<reconnect_context> reconnect_context_;
listener_context* listener_context_;
work_queue work_queue_;
@@ -100,10 +101,9 @@ class connection_context : public context {
// This is not a context object on its own, but an optional part of connection
class reconnect_context {
public:
- reconnect_context(const reconnect_options& ro, const connection_options& co);
+ reconnect_context(const reconnect_options& ro);
internal::pn_unique_ptr<const reconnect_options> reconnect_options_;
- internal::pn_unique_ptr<const connection_options> connection_options_;
duration delay_;
int retries_;
int current_url_;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d36257c/proton-c/bindings/cpp/src/proactor_container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proactor_container_impl.cpp b/proton-c/bindings/cpp/src/proactor_container_impl.cpp
index 533a13c..97e7e79 100644
--- a/proton-c/bindings/cpp/src/proactor_container_impl.cpp
+++ b/proton-c/bindings/cpp/src/proactor_container_impl.cpp
@@ -188,6 +188,7 @@ pn_connection_t* container::impl::make_connection_lh(
cc.handler = mh;
cc.work_queue_ = new container::impl::connection_work_queue(*container_.impl_, pnc);
cc.connected_address_ = url;
+ cc.connection_options_.reset(new connection_options(opts));
setup_connection_lh(url, pnc);
make_wrapper(pnc).open(opts);
@@ -224,7 +225,7 @@ void container::impl::reconnect(pn_connection_t* pnc) {
//std::cout << "Retries: " << rc.retries_ << " Delay: " << rc.delay_ << " Trying: " << url << "\n";
setup_connection_lh(url, pnc);
- make_wrapper(pnc).open(*rc.connection_options_);
+ make_wrapper(pnc).open(*cc.connection_options_);
start_connection(url, pnc);
// Did we go through all the urls?
@@ -534,7 +535,7 @@ bool container::impl::handle(pn_event_t* event) {
if (cc.listener_context_) {
cc.listener_context_->connection_options_->apply_bound(conn);
} else {
- client_connection_options_.apply_bound(conn);
+ cc.connection_options_->apply_bound(conn);
}
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org