Repository: qpid-proton Updated Branches: refs/heads/master a34c93bfb -> 7d404b6ee
PROTON-1363: [C++ binding] Remove unneeded stuff - collector from connection_context - proton::task Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/7d404b6e Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/7d404b6e Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/7d404b6e Branch: refs/heads/master Commit: 7d404b6ee1d5c4f03d4c0675d986774e10594538 Parents: a34c93b Author: Andrew Stitcher <[email protected]> Authored: Wed Nov 23 00:41:51 2016 -0500 Committer: Andrew Stitcher <[email protected]> Committed: Mon Nov 28 13:38:38 2016 -0500 ---------------------------------------------------------------------- proton-c/bindings/cpp/CMakeLists.txt | 2 - .../bindings/cpp/include/proton/container.hpp | 1 - proton-c/bindings/cpp/include/proton/task.hpp | 48 -------------------- proton-c/bindings/cpp/src/acceptor.cpp | 27 ----------- proton-c/bindings/cpp/src/connector.cpp | 1 - proton-c/bindings/cpp/src/container_impl.cpp | 5 +- .../bindings/cpp/src/include/container_impl.hpp | 5 +- proton-c/bindings/cpp/src/include/contexts.hpp | 3 +- proton-c/bindings/cpp/src/include/reactor.hpp | 3 +- .../bindings/cpp/src/io/connection_driver.cpp | 2 - proton-c/bindings/cpp/src/reactor.cpp | 7 +-- proton-c/bindings/cpp/src/receiver.cpp | 7 +-- proton-c/bindings/cpp/src/task.cpp | 29 ------------ 13 files changed, 10 insertions(+), 130 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt index 6af4319..5e0a8c7 100644 --- a/proton-c/bindings/cpp/CMakeLists.txt +++ b/proton-c/bindings/cpp/CMakeLists.txt @@ -27,7 +27,6 @@ include_directories( add_definitions(${CXX_WARNING_FLAGS}) set(qpid-proton-cpp-source - src/acceptor.cpp src/binary.cpp src/byte_array.cpp src/cached_map.cpp @@ -73,7 +72,6 @@ set(qpid-proton-cpp-source src/ssl.cpp src/ssl_domain.cpp src/target.cpp - src/task.cpp src/terminus.cpp src/timestamp.cpp src/tracker.cpp http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/include/proton/container.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/container.hpp b/proton-c/bindings/cpp/include/proton/container.hpp index 5006329..7d2d34c 100644 --- a/proton-c/bindings/cpp/include/proton/container.hpp +++ b/proton-c/bindings/cpp/include/proton/container.hpp @@ -46,7 +46,6 @@ class receiver; class receiver_options; class sender; class sender_options; -class task; /// A top-level container of connections, sessions, senders, and /// receivers. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/include/proton/task.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/task.hpp b/proton-c/bindings/cpp/include/proton/task.hpp deleted file mode 100644 index c13d7ad..0000000 --- a/proton-c/bindings/cpp/include/proton/task.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef PROTON_TASK_HPP -#define PROTON_TASK_HPP - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -/// @cond INTERNAL -/// XXX Needs more discussion - -#include "./internal/export.hpp" -#include "./internal/object.hpp" - -#include <proton/reactor.h> - -namespace proton { - -/// **Experimental** - A task for timer events. -class task : public internal::object<pn_task_t> { - public: - task(pn_task_t* t) : internal::object<pn_task_t>(t) {} - - /// Cancel the scheduled task. - PN_CPP_EXTERN void cancel(); -}; - -} // proton - -/// @endcond - -#endif // PROTON_TASK_HPP http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/src/acceptor.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/acceptor.cpp b/proton-c/bindings/cpp/src/acceptor.cpp deleted file mode 100644 index 1b5a0bd..0000000 --- a/proton-c/bindings/cpp/src/acceptor.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "acceptor.hpp" - -namespace proton { - -void acceptor::close() { pn_acceptor_close(pn_object()); } - -} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/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 91ba730..045d4de 100644 --- a/proton-c/bindings/cpp/src/connector.cpp +++ b/proton-c/bindings/cpp/src/connector.cpp @@ -25,7 +25,6 @@ #include "proton/transport.hpp" #include "proton/container.hpp" #include "proton/reconnect_timer.hpp" -#include "proton/task.hpp" #include "proton/sasl.hpp" #include "proton/url.hpp" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/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 aca67ae..a818c0f 100644 --- a/proton-c/bindings/cpp/src/container_impl.cpp +++ b/proton-c/bindings/cpp/src/container_impl.cpp @@ -27,7 +27,6 @@ #include "proton/event_loop.hpp" #include "proton/sender.hpp" #include "proton/receiver.hpp" -#include "proton/task.hpp" #include "proton/ssl.hpp" #include "proton/sasl.hpp" #include "proton/transport.hpp" @@ -265,12 +264,12 @@ void container_impl::stop_listening(const std::string& url) { close_acceptor(i->second); } -task container_impl::schedule(container& c, int delay, proton_handler *h) { +void container_impl::schedule(container& c, int delay, proton_handler *h) { container_impl& ci = static_cast<container_impl&>(c); internal::pn_ptr<pn_handler_t> task_handler; if (h) task_handler = ci.cpp_handler(h); - return ci.reactor_.schedule(delay, task_handler.get()); + ci.reactor_.schedule(delay, task_handler.get()); } namespace { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/src/include/container_impl.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/include/container_impl.hpp b/proton-c/bindings/cpp/src/include/container_impl.hpp index 97f6be2..0ffc2eb 100644 --- a/proton-c/bindings/cpp/src/include/container_impl.hpp +++ b/proton-c/bindings/cpp/src/include/container_impl.hpp @@ -22,8 +22,6 @@ * */ -#include "proton/io/link_namer.hpp" - #include "proton/container.hpp" #include "proton/connection.hpp" #include "proton/connection_options.hpp" @@ -48,7 +46,6 @@ class connector; class acceptor; class container; class url; -class task; class listen_handler; class container_impl : public standard_container { @@ -88,7 +85,7 @@ class container_impl : public standard_container { // non-interface functions void configure_server_connection(connection &c); - static task schedule(container& c, int delay, proton_handler *h); + static void schedule(container& c, int delay, proton_handler *h); template <class T> static void set_handler(T s, messaging_handler* h); private: http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/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 1d4194e..4306489 100644 --- a/proton-c/bindings/cpp/src/include/contexts.hpp +++ b/proton-c/bindings/cpp/src/include/contexts.hpp @@ -85,13 +85,12 @@ class context { // Connection context used by all connections. class connection_context : public context { public: - connection_context() : container(0), default_session(0), link_gen(0), collector(0) {} + connection_context() : container(0), default_session(0), link_gen(0) {} class container* container; pn_session_t *default_session; // Owned by connection. message event_message; // re-used by messaging_adapter for performance. io::link_namer* link_gen; // Link name generator. - pn_collector_t* collector; internal::pn_unique_ptr<proton_handler> handler; internal::pn_unique_ptr<class event_loop> event_loop; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/src/include/reactor.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/include/reactor.hpp b/proton-c/bindings/cpp/src/include/reactor.hpp index c7ab915..21df5ce 100644 --- a/proton-c/bindings/cpp/src/include/reactor.hpp +++ b/proton-c/bindings/cpp/src/include/reactor.hpp @@ -38,7 +38,6 @@ class container; class acceptor; class url; class messaging_handler; -class task; class reactor : public internal::object<pn_reactor_t> { public: @@ -74,7 +73,7 @@ class reactor : public internal::object<pn_reactor_t> { timestamp mark(); timestamp now(); - task schedule(int, pn_handler_t*); + void schedule(int, pn_handler_t*); class connection connection(pn_handler_t*) const; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/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 06b01d8..ca9f68e 100644 --- a/proton-c/bindings/cpp/src/io/connection_driver.cpp +++ b/proton-c/bindings/cpp/src/io/connection_driver.cpp @@ -68,8 +68,6 @@ void connection_driver::configure(const connection_options& opts, bool server) { pn_connection_driver_bind(&driver_); opts.apply_bound(c); handler_ = opts.handler(); - connection_context::get(connection()).collector = - pn_connection_collector(driver_.connection); } void connection_driver::connect(const connection_options& opts) { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/src/reactor.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/reactor.cpp b/proton-c/bindings/cpp/src/reactor.cpp index 15547f0..39f670f 100644 --- a/proton-c/bindings/cpp/src/reactor.cpp +++ b/proton-c/bindings/cpp/src/reactor.cpp @@ -21,7 +21,6 @@ #include "acceptor.hpp" #include "proton/connection.hpp" -#include "proton/task.hpp" #include "proton/url.hpp" #include "contexts.hpp" @@ -45,12 +44,14 @@ void reactor::yield() { pn_reactor_yield(pn_object()); } timestamp reactor::mark() { return timestamp(pn_reactor_mark(pn_object())); } timestamp reactor::now() { return timestamp(pn_reactor_now(pn_object())); } +void acceptor::close() { pn_acceptor_close(pn_object()); } + acceptor reactor::listen(const url& url){ return make_wrapper(pn_reactor_acceptor(pn_object(), url.host().c_str(), url.port().c_str(), 0)); } -task reactor::schedule(int delay, pn_handler_t* handler) { - return pn_reactor_schedule(pn_object(), delay, handler); +void reactor::schedule(int delay, pn_handler_t* handler) { + pn_reactor_schedule(pn_object(), delay, handler); } connection reactor::connection(pn_handler_t* h) const { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/src/receiver.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/receiver.cpp b/proton-c/bindings/cpp/src/receiver.cpp index e5ec55a..2c417f0 100644 --- a/proton-c/bindings/cpp/src/receiver.cpp +++ b/proton-c/bindings/cpp/src/receiver.cpp @@ -73,12 +73,7 @@ void receiver::drain() { // Drain is already complete. No state to communicate over the wire. // Create dummy flow event where "drain finish" can be detected. pn_connection_t *pnc = pn_session_connection(pn_link_session(pn_object())); - connection_context& cctx = connection_context::get(pnc); - // connection_driver collector is per connection. Reactor collector is global. - pn_collector_t *coll = cctx.collector; - if (!coll) - coll = pn_reactor_collector(pn_object_reactor(pnc)); - pn_collector_put(coll, PN_OBJECT, pn_object(), PN_LINK_FLOW); + pn_collector_put(pn_connection_collector(pnc), PN_OBJECT, pn_object(), PN_LINK_FLOW); } } } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7d404b6e/proton-c/bindings/cpp/src/task.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/task.cpp b/proton-c/bindings/cpp/src/task.cpp deleted file mode 100644 index b71212b..0000000 --- a/proton-c/bindings/cpp/src/task.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "proton/task.hpp" -#include <proton/reactor.h> - -namespace proton { - -void task::cancel() { pn_task_cancel(pn_object()); } - -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
