You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2016/01/25 18:30:09 UTC
[2/2] qpid-proton git commit: PROTON-1062: c++: remove
blocking_connection examples, to be replaced with connection_engine examples
PROTON-1062: c++: remove blocking_connection examples, to be replaced with connection_engine examples
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/290bc255
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/290bc255
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/290bc255
Branch: refs/heads/master
Commit: 290bc25563ed41002633ccde6d78f0777d0f23a6
Parents: 8f48341
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Jan 25 11:05:53 2016 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Mon Jan 25 12:22:30 2016 -0500
----------------------------------------------------------------------
proton-c/bindings/cpp/CMakeLists.txt | 7 --
proton-c/bindings/cpp/docs/tutorial.hpp | 19 ----
.../cpp/include/proton/blocking_connection.hpp | 61 -----------
.../cpp/include/proton/blocking_link.hpp | 57 ----------
.../cpp/include/proton/blocking_receiver.hpp | 62 -----------
.../cpp/include/proton/blocking_sender.hpp | 50 ---------
.../cpp/include/proton/request_response.hpp | 60 -----------
.../bindings/cpp/src/blocking_connection.cpp | 39 -------
.../cpp/src/blocking_connection_impl.cpp | 106 -------------------
.../cpp/src/blocking_connection_impl.hpp | 60 -----------
proton-c/bindings/cpp/src/blocking_fetcher.cpp | 67 ------------
proton-c/bindings/cpp/src/blocking_fetcher.hpp | 49 ---------
proton-c/bindings/cpp/src/blocking_link.cpp | 84 ---------------
proton-c/bindings/cpp/src/blocking_receiver.cpp | 102 ------------------
proton-c/bindings/cpp/src/blocking_sender.cpp | 68 ------------
proton-c/bindings/cpp/src/request_response.cpp | 57 ----------
16 files changed, 948 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 59f4d5b..7edbe7e 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -27,12 +27,6 @@ include_directories(
set(qpid-proton-cpp-source
src/acceptor.cpp
src/scalar.cpp
- src/blocking_connection.cpp
- src/blocking_connection_impl.cpp
- src/blocking_fetcher.cpp
- src/blocking_link.cpp
- src/blocking_receiver.cpp
- src/blocking_sender.cpp
src/connection.cpp
src/connection_options.cpp
src/connector.cpp
@@ -62,7 +56,6 @@ set(qpid-proton-cpp-source
src/reactor.cpp
src/receiver.cpp
src/reconnect_timer.cpp
- src/request_response.cpp
src/sasl.cpp
src/sender.cpp
src/session.cpp
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/docs/tutorial.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/docs/tutorial.hpp b/proton-c/bindings/cpp/docs/tutorial.hpp
index ca8a150..81ca7c9 100644
--- a/proton-c/bindings/cpp/docs/tutorial.hpp
+++ b/proton-c/bindings/cpp/docs/tutorial.hpp
@@ -388,25 +388,6 @@ Finally when we receive a message we look up its `reply_to` in our senders map a
\until }
\until }
-Synchronous Request/Response
-----------------------------
-
-The event-driven style of programming is extremely powerful, especially for
-server or mixed client-server programs. However for simple client-only programs
-a synchronous or blocking style of programming is sometimes simpler.
-
-`proton::blocking_connection` allows a blocking style of programming,
-`proton::request_response` automates the common case of synchronous
-request/response, send a request and block for the response.
-
-\ref sync_client.cpp is our request/response client in blocking style. Here's the key section
-
-\dontinclude sync_client.cpp
-\skip conn(
-\until }
-
-*/
-
/* TODO selector and browser
Many brokers offer the ability to consume messages based on a 'selector'
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
deleted file mode 100644
index bcdf0e7..0000000
--- a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef PROTON_CPP_BLOCKING_CONNECTION_H
-#define PROTON_CPP_BLOCKING_CONNECTION_H
-
-/*
- *
- * 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/export.hpp"
-#include "proton/duration.hpp"
-#include "proton/pn_unique_ptr.hpp"
-
-#include <string>
-
-namespace proton {
-class url;
-class connection;
-class blocking_connection_impl;
-
-// TODO documentation
-// Note: must not be deleted while there are proton::blocking_link instances that depend on it.
-class blocking_connection
-{
- public:
- PN_CPP_EXTERN blocking_connection(const proton::url &url, duration timeout = duration::FOREVER);
- PN_CPP_EXTERN ~blocking_connection();
- PN_CPP_EXTERN void close();
- PN_CPP_EXTERN duration timeout() const;
- PN_CPP_EXTERN class connection connection() const;
-
- private:
- blocking_connection(const blocking_connection&);
- blocking_connection& operator=(const blocking_connection&);
-
- pn_unique_ptr<blocking_connection_impl> impl_;
-
- friend class blocking_link;
- friend class blocking_sender;
- friend class blocking_receiver;
- friend class request_response;
-};
-
-}
-
-#endif /*!PROTON_CPP_BLOCKING_CONNECTION_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/include/proton/blocking_link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_link.hpp b/proton-c/bindings/cpp/include/proton/blocking_link.hpp
deleted file mode 100644
index ba584af..0000000
--- a/proton-c/bindings/cpp/include/proton/blocking_link.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef PROTON_CPP_BLOCKINGLINK_H
-#define PROTON_CPP_BLOCKINGLINK_H
-
-/*
- *
- * 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/export.hpp"
-#include "proton/duration.hpp"
-#include "proton/link.hpp"
-
-#include <string>
-
-namespace proton {
-class link;
-class blocking_connection;
-
-// TODO documentation
-class blocking_link
-{
- public:
- PN_CPP_EXTERN void close();
- PN_CPP_EXTERN ~blocking_link();
-
- protected:
- blocking_link(blocking_connection&);
- void open(link);
- void check_closed();
- void wait_for_closed();
-
- blocking_connection& connection_;
- link link_;
-
- private:
- blocking_link(const blocking_link&);
- blocking_link& operator=(const blocking_link&);
-};
-
-}
-
-#endif /*!PROTON_CPP_BLOCKINGLINK_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp b/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp
deleted file mode 100644
index 4d3b9fc..0000000
--- a/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef PROTON_CPP_BLOCKING_RECEIVER_HPP
-#define PROTON_CPP_BLOCKING_RECEIVER_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.
- *
- */
-#include "proton/blocking_link.hpp"
-#include "proton/delivery.hpp"
-#include "proton/export.hpp"
-#include "proton/message.hpp"
-#include "proton/pn_unique_ptr.hpp"
-
-#include <string>
-
-namespace proton {
-class receiver;
-class blocking_connection;
-class blocking_fetcher;
-
-// TODO documentation
-class blocking_receiver : public blocking_link
-{
- public:
- PN_CPP_EXTERN blocking_receiver(
- blocking_connection&, const std::string &address, int credit = 0, bool dynamic = false);
- PN_CPP_EXTERN ~blocking_receiver();
-
- PN_CPP_EXTERN message receive();
- PN_CPP_EXTERN message receive(duration timeout);
-
- PN_CPP_EXTERN void accept();
- PN_CPP_EXTERN void reject();
- PN_CPP_EXTERN void release(bool delivered = true);
- PN_CPP_EXTERN void settle();
- PN_CPP_EXTERN void settle(delivery::state state);
- PN_CPP_EXTERN void flow(int count);
-
- PN_CPP_EXTERN class receiver receiver();
- private:
- pn_unique_ptr<blocking_fetcher> fetcher_;
-};
-
-}
-
-#endif /*!PROTON_CPP_BLOCKING_RECEIVER_HPP*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/include/proton/blocking_sender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_sender.hpp b/proton-c/bindings/cpp/include/proton/blocking_sender.hpp
deleted file mode 100644
index a544e75..0000000
--- a/proton-c/bindings/cpp/include/proton/blocking_sender.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef PROTON_CPP_BLOCKING_SENDER_H
-#define PROTON_CPP_BLOCKING_SENDER_H
-
-/*
- *
- * 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/export.hpp"
-#include "proton/delivery.hpp"
-#include "proton/message.hpp"
-#include "proton/blocking_link.hpp"
-
-#include <string>
-
-namespace proton {
-class sender;
-class blocking_connection;
-
-// TODO documentation
-class blocking_sender : public blocking_link
-{
- public:
- PN_CPP_EXTERN blocking_sender(class blocking_connection &c, const std::string &address);
- PN_CPP_EXTERN ~blocking_sender();
-
- PN_CPP_EXTERN delivery send(const message &msg);
- PN_CPP_EXTERN delivery send(const message &msg, duration timeout);
-
- PN_CPP_EXTERN class sender sender() const;
-};
-
-}
-
-#endif /*!PROTON_CPP_BLOCKING_SENDER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/include/proton/request_response.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/request_response.hpp b/proton-c/bindings/cpp/include/proton/request_response.hpp
deleted file mode 100644
index 23af836..0000000
--- a/proton-c/bindings/cpp/include/proton/request_response.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef PROTON_CPP_SYNC_REQUEST_RESPONSE_H
-#define PROTON_CPP_SYNC_REQUEST_RESPONSE_H
-
-/*
- *
- * 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/blocking_receiver.hpp"
-#include "proton/blocking_sender.hpp"
-#include "proton/export.hpp"
-#include "proton/handler.hpp"
-#include "proton/pn_unique_ptr.hpp"
-
-#include <string>
-
-namespace proton {
-
-/**
- * An implementation of the synchronous request-response pattern (aka RPC).
- */
-class request_response
-{
- public:
- PN_CPP_EXTERN request_response(
- blocking_connection &, const std::string address=std::string());
- /**
- * Send a request message, wait for and return the response message.
- * Modifies the message to set `address` (if not already set), `reply_to` and `correlation_id`.
- */
- PN_CPP_EXTERN message call(message &request);
- /** Return the dynamic address of our receiver. */
- PN_CPP_EXTERN std::string reply_to() const;
-
- private:
- blocking_connection &connection_;
- std::string address_;
- pn_unique_ptr<blocking_sender> sender_;
- pn_unique_ptr<blocking_receiver> receiver_;
- amqp_ulong correlation_id_;
-};
-
-}
-
-#endif /*!PROTON_CPP_SYNC_REQUEST_RESPONSE_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_connection.cpp b/proton-c/bindings/cpp/src/blocking_connection.cpp
deleted file mode 100644
index c7f243b..0000000
--- a/proton-c/bindings/cpp/src/blocking_connection.cpp
+++ /dev/null
@@ -1,39 +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/container.hpp"
-#include "proton/blocking_connection.hpp"
-#include "blocking_connection_impl.hpp"
-
-namespace proton {
-
-blocking_connection::blocking_connection(const proton::url &url, duration timeout) :
- impl_(new blocking_connection_impl(url, timeout))
-{}
-
-blocking_connection::~blocking_connection() {}
-
-void blocking_connection::close() { impl_->close(); }
-
-duration blocking_connection::timeout() const { return impl_->container_->reactor().timeout(); }
-
-connection blocking_connection::connection() const { return impl_->connection_; }
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_connection_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_connection_impl.cpp b/proton-c/bindings/cpp/src/blocking_connection_impl.cpp
deleted file mode 100644
index f05efb6..0000000
--- a/proton-c/bindings/cpp/src/blocking_connection_impl.cpp
+++ /dev/null
@@ -1,106 +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/container.hpp"
-#include "proton/handler.hpp"
-#include "proton/duration.hpp"
-#include "proton/connection.h"
-#include "proton/error.hpp"
-
-#include "blocking_connection_impl.hpp"
-#include "msg.hpp"
-#include "contexts.hpp"
-
-
-namespace proton {
-
-namespace {
-struct connection_opening : public blocking_connection_impl::condition {
- connection_opening(const connection& c) : connection_(c) {}
- bool operator()() const { return (connection_.state()) & PN_REMOTE_UNINIT; }
- const connection& connection_;
-};
-
-struct connection_closed : public blocking_connection_impl::condition {
- connection_closed(const connection& c) : connection_(c) {}
- bool operator()() const { return !(connection_.state() & PN_REMOTE_ACTIVE); }
- const connection& connection_;
-};
-}
-
-blocking_connection_impl::blocking_connection_impl(const url& url, duration timeout) :
- container_(new container())
-{
- container_->reactor().start();
- container_->reactor().timeout(timeout);
- handler* h = this; // Set this as handler.
- connection_ = container_->connect(url, connection_options().handler(h));
- wait(connection_opening(connection_));
-}
-
-blocking_connection_impl::~blocking_connection_impl() {
- container_->reactor().stop();
-}
-
-void blocking_connection_impl::close() {
- connection_.close();
- wait(connection_closed(connection_));
-}
-
-namespace {
-struct save_timeout {
- reactor& reactor_;
- duration timeout_;
- save_timeout(reactor& r) : reactor_(r), timeout_(r.timeout()) {}
- ~save_timeout() { reactor_.timeout(timeout_); }
-};
-}
-
-void blocking_connection_impl::wait(const condition &condition, const std::string &msg, duration wait_timeout)
-{
- reactor reactor = container_->reactor();
-
- if (wait_timeout == duration(-1))
- wait_timeout = reactor.timeout();
-
- if (wait_timeout == duration::FOREVER) {
- while (!condition()) {
- reactor.process();
- }
- } else {
- save_timeout st(reactor);
- reactor.timeout(wait_timeout);
- pn_timestamp_t deadline = reactor.mark() + wait_timeout.milliseconds;
- while (!condition()) {
- reactor.process();
- if (!condition()) {
- pn_timestamp_t now = reactor.mark();
- if (now < deadline)
- reactor.timeout(duration(deadline - now));
- else
- throw timeout_error("connection timed out " + msg);
- }
- }
- }
-}
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_connection_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_connection_impl.hpp b/proton-c/bindings/cpp/src/blocking_connection_impl.hpp
deleted file mode 100644
index 0c7f02d..0000000
--- a/proton-c/bindings/cpp/src/blocking_connection_impl.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef PROTON_CPP_BLOCKING_CONNECTION_IMPL_H
-#define PROTON_CPP_BLOCKING_CONNECTION_IMPL_H
-
-/*
- *
- * 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/export.hpp"
-#include "proton/container.hpp"
-#include "proton/handler.hpp"
-#include "proton/connection.hpp"
-#include "proton/types.h"
-#include <string>
-
-struct pn_connection_t;
-
-namespace proton {
-
-class handler;
-class container;
-
-class blocking_connection_impl : public handler
-{
- public:
- blocking_connection_impl(const url &url, duration d);
- ~blocking_connection_impl();
-
- void close();
-
- struct condition {
- virtual ~condition() {}
- virtual bool operator()() const = 0;
- };
-
- void wait(const condition&, const std::string & ="", duration=duration(-1));
-
- pn_unique_ptr<container> container_;
- connection connection_;
-};
-
-
-}
-
-#endif /*!PROTON_CPP_BLOCKING_CONNECTION_IMPL_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_fetcher.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_fetcher.cpp b/proton-c/bindings/cpp/src/blocking_fetcher.cpp
deleted file mode 100644
index fb95aaf..0000000
--- a/proton-c/bindings/cpp/src/blocking_fetcher.cpp
+++ /dev/null
@@ -1,67 +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 "blocking_fetcher.hpp"
-#include "proton/container.hpp"
-#include "msg.hpp"
-
-#include "proton/event.hpp"
-
-namespace proton {
-
-blocking_fetcher::blocking_fetcher(int prefetch) : handler(prefetch, false /*auto_accept*/) {}
-
-void blocking_fetcher::on_message(event &e) {
- messages_.push_back(e.message());
- deliveries_.push_back(e.delivery());
- // Wake up enclosing connection.wait()
- e.container().reactor().yield();
-}
-
-void blocking_fetcher::on_link_error(event &e) {
- link lnk = e.link();
- if (lnk.state() & PN_LOCAL_ACTIVE) {
- lnk.close();
- throw error(MSG("Link detached: " << lnk.name()));
- }
-}
-
-bool blocking_fetcher::has_message() { return !messages_.empty(); }
-
-message blocking_fetcher::pop() {
- if (messages_.empty())
- throw error(MSG("receiver has no messages"));
- delivery dlv(deliveries_.front());
- if (!dlv.settled())
- unsettled_.push_back(dlv);
- message m = messages_.front();
- messages_.pop_front();
- deliveries_.pop_front();
- return m;
-}
-
-void blocking_fetcher::settle(delivery::state state) {
- delivery dlv = unsettled_.front();
- if (state)
- dlv.update(state);
- dlv.settle();
-}
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_fetcher.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_fetcher.hpp b/proton-c/bindings/cpp/src/blocking_fetcher.hpp
deleted file mode 100644
index b3e2169..0000000
--- a/proton-c/bindings/cpp/src/blocking_fetcher.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef PROTON_CPP_FETCHER_H
-#define PROTON_CPP_FETCHER_H
-
-/*
- *
- * 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/delivery.hpp"
-#include "proton/handler.hpp"
-#include "proton/message.hpp"
-#include <string>
-#include <deque>
-
-namespace proton {
-
-class blocking_fetcher : public handler {
- public:
- blocking_fetcher(int prefetch);
- void on_message(event &e);
- void on_link_error(event &e);
- bool has_message();
- message pop();
- void settle(delivery::state state = delivery::NONE);
-
- private:
- std::deque<message> messages_;
- std::deque<delivery> deliveries_;
- std::deque<delivery> unsettled_;
-};
-
-}
-
-#endif /*!PROTON_CPP_FETCHER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_link.cpp b/proton-c/bindings/cpp/src/blocking_link.cpp
deleted file mode 100644
index 262f6d0..0000000
--- a/proton-c/bindings/cpp/src/blocking_link.cpp
+++ /dev/null
@@ -1,84 +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/blocking_link.hpp"
-#include "proton/blocking_connection.hpp"
-#include "proton/connection.hpp"
-#include "proton/error.hpp"
-#include "proton/link.hpp"
-
-#include "blocking_connection_impl.hpp"
-#include "msg.hpp"
-
-#include <proton/link.h>
-
-namespace proton {
-
-namespace {
-struct link_opened : public blocking_connection_impl::condition {
- link_opened(link l) : pn_link(l) {}
- bool operator()() const { return !(pn_link.state() & PN_REMOTE_UNINIT); }
- link pn_link;
-};
-
-struct link_closed : public blocking_connection_impl::condition {
- link_closed(link l) : pn_link(l) {}
- bool operator()() const { return (pn_link.state() & PN_REMOTE_CLOSED); }
- link pn_link;
-};
-
-struct link_not_open : public blocking_connection_impl::condition {
- link_not_open(link l) : pn_link(l) {}
- bool operator()() const { return !(pn_link.state() & PN_REMOTE_ACTIVE); }
- link pn_link;
-};
-
-} // namespace
-
-blocking_link::blocking_link(blocking_connection &c) : connection_(c) {}
-
-void blocking_link::open(proton::link l) {
- link_ = l;
- connection_.impl_->wait(link_opened(link_), "opening link " + link_.name());
- check_closed();
-}
-
-blocking_link::~blocking_link() {}
-
-void blocking_link::wait_for_closed() {
- link_closed link_closed(link_);
- connection_.impl_->wait(link_closed, "closing link " + link_.name());
- check_closed();
-}
-
-void blocking_link::check_closed() {
- if (link_.state() & PN_REMOTE_CLOSED) {
- link_.close();
- throw error(MSG("Link detached: " << link_.name()));
- }
-}
-
-void blocking_link::close() {
- link_.close();
- link_not_open link_not_open(link_);
- connection_.impl_->wait(link_not_open, "closing link " + link_.name());
-}
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_receiver.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_receiver.cpp b/proton-c/bindings/cpp/src/blocking_receiver.cpp
deleted file mode 100644
index 755c30c..0000000
--- a/proton-c/bindings/cpp/src/blocking_receiver.cpp
+++ /dev/null
@@ -1,102 +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/blocking_connection.hpp"
-#include "proton/blocking_receiver.hpp"
-#include "proton/receiver.hpp"
-#include "proton/connection.hpp"
-#include "proton/receiver.hpp"
-#include "proton/error.hpp"
-
-#include "blocking_connection_impl.hpp"
-#include "blocking_fetcher.hpp"
-#include "msg.hpp"
-
-
-namespace proton {
-
-namespace {
-
-struct fetcher_has_message : public blocking_connection_impl::condition {
- fetcher_has_message(blocking_fetcher &f) : fetcher_(f) {}
- bool operator()() const { return fetcher_.has_message(); }
- blocking_fetcher &fetcher_;
-};
-
-} // namespace
-
-blocking_receiver::blocking_receiver(
- class blocking_connection &c, const std::string& addr, int credit, bool dynamic) :
- blocking_link(c), fetcher_(new blocking_fetcher(credit))
-{
- open(c.impl_->connection_.open_receiver(addr, link_options().dynamic_address(dynamic).handler(fetcher_.get())));
- std::string sa = link_.local_source().address();
- std::string rsa = link_.remote_source().address();
- if (!sa.empty() && sa.compare(rsa) != 0) {
- wait_for_closed();
- link_.close();
- std::string txt = "Failed to open receiver " + link_.name() + ", source does not match";
- throw error(MSG(txt));
- }
- if (credit)
- link_.receiver().flow(credit);
-}
-
-blocking_receiver::~blocking_receiver() { link_.detach_handler(); }
-
-message blocking_receiver::receive(duration timeout) {
- if (!receiver().credit())
- receiver().flow(1);
- fetcher_has_message cond(*fetcher_);
- connection_.impl_->wait(cond, "receiving on receiver " + link_.name(), timeout);
- return fetcher_->pop();
-}
-
-message blocking_receiver::receive() {
- // Use default timeout
- return receive(connection_.timeout());
-}
-
-void blocking_receiver::accept() {
- settle(delivery::ACCEPTED);
-}
-
-void blocking_receiver::reject() {
- settle(delivery::REJECTED);
-}
-
-void blocking_receiver::release(bool delivered) {
- if (delivered)
- settle(delivery::MODIFIED);
- else
- settle(delivery::RELEASED);
-}
-
-void blocking_receiver::settle(delivery::state state = delivery::NONE) {
- fetcher_->settle(state);
-}
-
-void blocking_receiver::flow(int count) {
- receiver().flow(count);
-}
-
-receiver blocking_receiver::receiver() { return link_.receiver(); }
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/blocking_sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_sender.cpp b/proton-c/bindings/cpp/src/blocking_sender.cpp
deleted file mode 100644
index b42698c..0000000
--- a/proton-c/bindings/cpp/src/blocking_sender.cpp
+++ /dev/null
@@ -1,68 +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/blocking_sender.hpp"
-#include "proton/blocking_connection.hpp"
-#include "proton/sender.hpp"
-#include "proton/receiver.hpp"
-#include "proton/error.hpp"
-#include "blocking_connection_impl.hpp"
-#include "msg.hpp"
-
-namespace proton {
-
-namespace {
-struct delivery_settled : public blocking_connection_impl::condition {
- delivery_settled(const delivery& d) : pn_delivery(d) {}
- bool operator()() const { return pn_delivery.settled(); }
- const delivery& pn_delivery;
-};
-} // namespace
-
-blocking_sender::blocking_sender(blocking_connection &c, const std::string &address) :
- blocking_link(c)
-{
- open(c.impl_->connection_.open_sender(address));
- std::string ta = link_.local_target().address();
- std::string rta = link_.remote_target().address();
- if (ta.empty() || ta.compare(rta) != 0) {
- wait_for_closed();
- link_.close();
- std::string txt = "Failed to open sender " + link_.name() + ", target does not match";
- throw error(MSG(txt));
- }
-}
-
-blocking_sender::~blocking_sender() {}
-
-delivery blocking_sender::send(const message &msg, duration timeout) {
- delivery dlv = sender().send(msg);
- connection_.impl_->wait(delivery_settled(dlv), "sending on sender " + link_.name(), timeout);
- return dlv;
-}
-
-delivery blocking_sender::send(const message &msg) {
- // Use default timeout
- return send(msg, connection_.timeout());
-}
-
-sender blocking_sender::sender() const { return link_.sender(); }
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/290bc255/proton-c/bindings/cpp/src/request_response.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/request_response.cpp b/proton-c/bindings/cpp/src/request_response.cpp
deleted file mode 100644
index 694d727..0000000
--- a/proton-c/bindings/cpp/src/request_response.cpp
+++ /dev/null
@@ -1,57 +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/blocking_connection.hpp"
-#include "proton/request_response.hpp"
-#include "proton/event.hpp"
-#include "proton/error.hpp"
-#include "proton/message_id.hpp"
-#include "blocking_connection_impl.hpp"
-#include "msg.hpp"
-
-namespace proton {
-
-request_response::request_response(blocking_connection &conn, const std::string addr):
- connection_(conn), address_(addr),
- sender_(new blocking_sender(connection_, addr)),
- receiver_(new blocking_receiver(connection_, "", 1/*credit*/, true/*dynamic*/)),
- correlation_id_(0)
-{}
-
-message request_response::call(message &request) {
- if (address_.empty() && request.address().empty())
- throw error(MSG("Request message has no address"));
- // TODO: atomic increment.
- message_id cid(++correlation_id_);
- request.correlation_id(cid);
- request.reply_to(this->reply_to());
- sender_->send(request);
- message response;
- while (response.correlation_id() != cid) {
- response = receiver_->receive();
- }
- return response;
-}
-
-std::string request_response::reply_to() const {
- return receiver_->receiver().remote_source().address();
-}
-
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org