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/03/23 19:58:46 UTC
[3/3] qpid-proton git commit: PROTON-1161: c++: drop use of on_start
by connection_engine.
PROTON-1161: c++: drop use of on_start by connection_engine.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/38a71ffe
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/38a71ffe
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/38a71ffe
Branch: refs/heads/master
Commit: 38a71ffe5fd34de17b14564d7f121bd9594c5e94
Parents: 222574e
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Mar 23 13:58:23 2016 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Mar 23 14:20:07 2016 -0400
----------------------------------------------------------------------
examples/cpp/engine/broker.cpp | 3 +--
examples/cpp/engine/client.cpp | 3 +--
examples/cpp/engine/direct_recv.cpp | 4 ----
examples/cpp/engine/direct_send.cpp | 4 ----
examples/cpp/engine/helloworld.cpp | 3 +--
examples/cpp/engine/server.cpp | 3 +--
examples/cpp/engine/simple_recv.cpp | 3 +--
examples/cpp/engine/simple_send.cpp | 3 +--
proton-c/bindings/cpp/include/proton/io/socket.hpp | 4 ++--
proton-c/bindings/cpp/src/io/connection_engine.cpp | 9 ---------
proton-c/bindings/cpp/src/io/posix/socket.cpp | 1 +
proton-c/bindings/cpp/src/io/windows/socket.cpp | 1 +
12 files changed, 10 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/broker.cpp b/examples/cpp/engine/broker.cpp
index 698d795..78bcbb4 100644
--- a/examples/cpp/engine/broker.cpp
+++ b/examples/cpp/engine/broker.cpp
@@ -127,8 +127,7 @@ int main(int argc, char **argv) {
#include "proton/container.hpp"
#include "proton/value.hpp"
-
-#include "fake_cpp11.hpp"
+#include "../fake_cpp11.hpp"
class broker {
public:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/client.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/client.cpp b/examples/cpp/engine/client.cpp
index 941ca75..ac3ec08 100644
--- a/examples/cpp/engine/client.cpp
+++ b/examples/cpp/engine/client.cpp
@@ -41,8 +41,7 @@ class client : public proton::handler {
public:
client(const proton::url &u, const std::vector<std::string>& r) : url(u), requests(r) {}
- void on_start(proton::event &e) override {
- e.connection().open();
+ void on_connection_open(proton::event &e) override {
sender = e.connection().open_sender(url.path());
receiver = e.connection().open_receiver("", proton::link_options().dynamic_address(true));
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/direct_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/direct_recv.cpp b/examples/cpp/engine/direct_recv.cpp
index 51f6572..1a2f138 100644
--- a/examples/cpp/engine/direct_recv.cpp
+++ b/examples/cpp/engine/direct_recv.cpp
@@ -41,10 +41,6 @@ class direct_recv : public proton::handler {
public:
direct_recv(int c) : expected(c), received(0) {}
- void on_start(proton::event &e) override {
- e.connection().open();
- }
-
void on_message(proton::event &e) override {
proton::message& msg = e.message();
if (msg.id().get<uint64_t>() < received)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/direct_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/direct_send.cpp b/examples/cpp/engine/direct_send.cpp
index 4d7be72..a79136f 100644
--- a/examples/cpp/engine/direct_send.cpp
+++ b/examples/cpp/engine/direct_send.cpp
@@ -42,10 +42,6 @@ class simple_send : public proton::handler {
public:
simple_send(int c) : sent(0), confirmed(0), total(c) {}
- void on_start(proton::event &e) override {
- e.connection().open();
- }
-
void on_sendable(proton::event &e) override {
proton::sender sender = e.sender();
while (sender.credit() && sent < total) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/helloworld.cpp b/examples/cpp/engine/helloworld.cpp
index 4bb0ed3..7d9f507 100644
--- a/examples/cpp/engine/helloworld.cpp
+++ b/examples/cpp/engine/helloworld.cpp
@@ -35,8 +35,7 @@ class hello_world : public proton::handler {
public:
hello_world(const std::string& address) : address_(address) {}
- void on_start(proton::event &e) override {
- e.connection().open();
+ void on_connection_open(proton::event &e) override {
e.connection().open_receiver(address_);
e.connection().open_sender(address_);
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/server.cpp b/examples/cpp/engine/server.cpp
index bdd1a73..9bb896f 100644
--- a/examples/cpp/engine/server.cpp
+++ b/examples/cpp/engine/server.cpp
@@ -45,8 +45,7 @@ class server : public proton::handler {
server(const std::string &u) : url(u) {}
- void on_start(proton::event &e) override {
- e.connection().open();
+ void on_connection_open(proton::event &e) override {
e.connection().open_receiver(url.path());
std::cout << "server connected to " << url << std::endl;
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/simple_recv.cpp b/examples/cpp/engine/simple_recv.cpp
index a081227..d5327bf 100644
--- a/examples/cpp/engine/simple_recv.cpp
+++ b/examples/cpp/engine/simple_recv.cpp
@@ -44,8 +44,7 @@ class simple_recv : public proton::handler {
simple_recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
- void on_start(proton::event &e) override {
- e.connection().open();
+ void on_connection_open(proton::event &e) override {
receiver = e.connection().open_receiver(url.path());
std::cout << "simple_recv listening on " << url << std::endl;
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/examples/cpp/engine/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/simple_send.cpp b/examples/cpp/engine/simple_send.cpp
index f6c0318..5161852 100644
--- a/examples/cpp/engine/simple_send.cpp
+++ b/examples/cpp/engine/simple_send.cpp
@@ -44,8 +44,7 @@ class simple_send : public proton::handler {
simple_send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
- void on_start(proton::event &e) override {
- e.connection().open();
+ void on_connection_open(proton::event &e) override {
sender = e.connection().open_sender(url.path());
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/proton-c/bindings/cpp/include/proton/io/socket.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/io/socket.hpp b/proton-c/bindings/cpp/include/proton/io/socket.hpp
index a43c0ae..bcbcecf 100644
--- a/proton-c/bindings/cpp/include/proton/io/socket.hpp
+++ b/proton-c/bindings/cpp/include/proton/io/socket.hpp
@@ -100,10 +100,10 @@ class listener {
/// A \ref connection_engine with non-blocking socket IO.
class engine : public connection_engine {
public:
- /// Wrap an open socket. Sets non-blocking mode.
+ /// Wrap an open socket. Does not automatically open the connection.
PN_CPP_EXTERN engine(descriptor socket_, handler&, const connection_options& = connection_options());
- /// Create socket engine connected to url.
+ /// Create socket engine connected to url, open the connection as a client.
PN_CPP_EXTERN engine(const url&, handler&, const connection_options& = connection_options());
PN_CPP_EXTERN ~engine();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/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 5d8e5cc..9513110 100644
--- a/proton-c/bindings/cpp/src/io/connection_engine.cpp
+++ b/proton-c/bindings/cpp/src/io/connection_engine.cpp
@@ -109,15 +109,6 @@ bool connection_engine::dispatch() {
e;
e = pn_collector_peek(collector_.get()))
{
- switch (pn_event_type(e)) {
- case PN_CONNECTION_INIT:
- // FIXME aconway 2016-03-21: don't use START in connection handlers
- // reserve it for containers.
- proton_event(e, PN_REACTOR_INIT, 0).dispatch(h);
- break;
- default:
- break;
- }
proton_event(e, pn_event_type(e), 0).dispatch(h);
pn_collector_pop(collector_.get());
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/proton-c/bindings/cpp/src/io/posix/socket.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/io/posix/socket.cpp b/proton-c/bindings/cpp/src/io/posix/socket.cpp
index 656a837..e275288 100644
--- a/proton-c/bindings/cpp/src/io/posix/socket.cpp
+++ b/proton-c/bindings/cpp/src/io/posix/socket.cpp
@@ -78,6 +78,7 @@ engine::engine(const url& u, handler& h, const connection_options& opts)
: connection_engine(h, opts), socket_(connect(u))
{
init();
+ connection().open();
}
engine::~engine() {}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38a71ffe/proton-c/bindings/cpp/src/io/windows/socket.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/io/windows/socket.cpp b/proton-c/bindings/cpp/src/io/windows/socket.cpp
index afd3b56..27660d8 100644
--- a/proton-c/bindings/cpp/src/io/windows/socket.cpp
+++ b/proton-c/bindings/cpp/src/io/windows/socket.cpp
@@ -93,6 +93,7 @@ engine::engine(const url& u, handler& h, const connection_options &opts)
: connection_engine(h, opts), socket_(connect(u))
{
init();
+ connection().open();
}
engine::~engine() {}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org