qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [07/38] qpid-proton git commit: PROTON-1402: Simplify access to connection_context
Date Thu, 23 Feb 2017 22:51:14 GMT
PROTON-1402: Simplify access to connection_context


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

Branch: refs/heads/go1
Commit: b9a57e8a78c547bc1d01506ecb636b50dc4ee8d6
Parents: 431696d
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Wed Feb 8 13:26:15 2017 -0500
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Thu Feb 9 21:56:41 2017 -0500

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/connection_options.cpp   | 4 ++--
 proton-c/bindings/cpp/src/container_impl.cpp       | 4 ++--
 proton-c/bindings/cpp/src/contexts.cpp             | 4 ----
 proton-c/bindings/cpp/src/include/contexts.hpp     | 2 --
 proton-c/bindings/cpp/src/io/connection_driver.cpp | 4 ++--
 proton-c/bindings/cpp/src/io/link_namer.cpp        | 3 ++-
 proton-c/bindings/cpp/src/session.cpp              | 2 +-
 7 files changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9a57e8a/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 c30b98d..506e84e 100644
--- a/proton-c/bindings/cpp/src/connection_options.cpp
+++ b/proton-c/bindings/cpp/src/connection_options.cpp
@@ -75,7 +75,7 @@ class connection_options::impl {
     void apply_unbound(connection& c) {
         pn_connection_t *pnc = unwrap(c);
         container::impl::connector *outbound = dynamic_cast<container::impl::connector*>(
-            connection_context::get(c).handler.get());
+            connection_context::get(unwrap(c)).handler.get());
 
         // Only apply connection options if uninit.
         bool uninit = c.uninitialized();
@@ -98,7 +98,7 @@ class connection_options::impl {
         // and if there is a pipelined open frame.
         pn_connection_t *pnc = unwrap(c);
         container::impl::connector *outbound = dynamic_cast<container::impl::connector*>(
-            connection_context::get(c).handler.get());
+            connection_context::get(unwrap(c)).handler.get());
 
         pn_transport_t *pnt = pn_connection_transport(pnc);
         if (!pnt) return;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9a57e8a/proton-c/bindings/cpp/src/container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp
index 9cec831..d58fc09 100644
--- a/proton-c/bindings/cpp/src/container_impl.cpp
+++ b/proton-c/bindings/cpp/src/container_impl.cpp
@@ -190,7 +190,7 @@ returned<connection> container::impl::connect(const std::string
&urlstr, const c
     proton::url  url(urlstr);
     connection conn(reactor_.connection_to_host(url.host(), url.port(), chandler.get()));
     internal::pn_unique_ptr<connector> ctor(new connector(conn, opts, url));
-    connection_context& cc(connection_context::get(conn));
+    connection_context& cc(connection_context::get(unwrap(conn)));
     cc.handler.reset(ctor.release());
     cc.event_loop_ = new event_loop::impl;
 
@@ -344,7 +344,7 @@ void container::impl::configure_server_connection(connection &c) {
         pn_record_t *record = pn_connection_attachments(unwrap(c));
         pn_record_set_handler(record, chandler.get());
     }
-    connection_context::get(c).event_loop_ = new event_loop::impl;
+    connection_context::get(unwrap(c)).event_loop_ = new event_loop::impl;
 }
 
 void container::impl::run() {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9a57e8a/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 231506f..8da8f7c 100644
--- a/proton-c/bindings/cpp/src/contexts.cpp
+++ b/proton-c/bindings/cpp/src/contexts.cpp
@@ -77,10 +77,6 @@ context::id connection_context::id(pn_connection_t* c) {
     return context::id(pn_connection_attachments(c), CONNECTION_CONTEXT);
 }
 
-context::id connection_context::id(const connection& c) {
-    return id(unwrap(c));
-}
-
 void container_context::set(const reactor& r, container& c) {
     set_context(pn_reactor_attachments(unwrap(r)), CONTAINER_CONTEXT, PN_VOID, &c);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9a57e8a/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 e80c434..742b346 100644
--- a/proton-c/bindings/cpp/src/include/contexts.hpp
+++ b/proton-c/bindings/cpp/src/include/contexts.hpp
@@ -96,11 +96,9 @@ class connection_context : public context {
     event_loop event_loop_;
 
     static connection_context& get(pn_connection_t *c) { return ref<connection_context>(id(c));
}
-    static connection_context& get(const connection& c) { return ref<connection_context>(id(c));
}
 
   protected:
     static context::id id(pn_connection_t*);
-    static context::id id(const connection& c);
 };
 
 void container_context(const reactor&, container&);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9a57e8a/proton-c/bindings/cpp/src/io/connection_driver.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/io/connection_driver.cpp b/proton-c/bindings/cpp/src/io/connection_driver.cpp
index 148a00b..38e5bf2 100644
--- a/proton-c/bindings/cpp/src/io/connection_driver.cpp
+++ b/proton-c/bindings/cpp/src/io/connection_driver.cpp
@@ -51,14 +51,14 @@ connection_driver::connection_driver() : handler_(0), container_(0) {
init(); }
 
 connection_driver::connection_driver(class container& cont) : handler_(0), container_(&cont)
{
     init();
-    connection_context& ctx = connection_context::get(connection());
+    connection_context& ctx = connection_context::get(unwrap(connection()));
     ctx.container = container_;
 }
 
 #if PN_CPP_HAS_RVALUE_REFERENCES
 connection_driver::connection_driver(class container& cont, event_loop&& loop)
: handler_(0), container_(&cont) {
     init();
-    connection_context& ctx = connection_context::get(connection());
+    connection_context& ctx = connection_context::get(unwrap(connection()));
     ctx.container = container_;
     ctx.event_loop_ = loop.impl_.get();
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9a57e8a/proton-c/bindings/cpp/src/io/link_namer.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/io/link_namer.cpp b/proton-c/bindings/cpp/src/io/link_namer.cpp
index 307c423..28c35c7 100644
--- a/proton-c/bindings/cpp/src/io/link_namer.cpp
+++ b/proton-c/bindings/cpp/src/io/link_namer.cpp
@@ -18,13 +18,14 @@
  */
 
 #include "proton/io/link_namer.hpp"
+#include "proton_bits.hpp"
 #include "contexts.hpp"
 
 namespace proton {
 namespace io {
 
 void set_link_namer(connection& c, link_namer& l) {
-    connection_context::get(c).link_gen = &l;
+    connection_context::get(unwrap(c)).link_gen = &l;
 }
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9a57e8a/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 de152d6..8036d2c 100644
--- a/proton-c/bindings/cpp/src/session.cpp
+++ b/proton-c/bindings/cpp/src/session.cpp
@@ -59,7 +59,7 @@ connection session::connection() const {
 
 namespace {
 std::string next_link_name(const connection& c) {
-    io::link_namer* ln = connection_context::get(c).link_gen;
+    io::link_namer* ln = connection_context::get(unwrap(c)).link_gen;
 
     return ln ? ln->link_name() : uuid::random().str();
 }


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


Mime
View raw message