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 2017/12/19 19:13:22 UTC
[1/2] qpid-proton git commit: Revert PROTON-1703: [cpp] Remove
auto_settle from receiver_options
Repository: qpid-proton
Updated Branches:
refs/heads/master 38afef9d2 -> 3311dd602
Revert PROTON-1703: [cpp] Remove auto_settle from receiver_options
Reverted the change for binary compatibility but deprecated auto_settle
since it is a no-op on receiver. To remove at next major revision.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/b9f94025
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/b9f94025
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/b9f94025
Branch: refs/heads/master
Commit: b9f9402598171602ed7d3c6f7dd410906d1d0684
Parents: 38afef9
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Dec 19 13:43:25 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Dec 19 13:50:00 2017 -0500
----------------------------------------------------------------------
proton-c/bindings/cpp/include/proton/receiver_options.hpp | 3 +++
proton-c/bindings/cpp/src/receiver_options.cpp | 7 +++++++
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9f94025/proton-c/bindings/cpp/include/proton/receiver_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/receiver_options.hpp b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
index 049fe86..2213f88 100644
--- a/proton-c/bindings/cpp/include/proton/receiver_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
@@ -83,6 +83,9 @@ class receiver_options {
/// default.
PN_CPP_EXTERN receiver_options& auto_accept(bool);
+ /// @deprecated not applicable to receiver, only to sender
+ PN_CPP_EXTERN receiver_options& auto_settle(bool);
+
/// Options for the source node of the receiver.
PN_CPP_EXTERN receiver_options& source(source_options&);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9f94025/proton-c/bindings/cpp/src/receiver_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/receiver_options.cpp b/proton-c/bindings/cpp/src/receiver_options.cpp
index 96e2ffa..cb4ac05 100644
--- a/proton-c/bindings/cpp/src/receiver_options.cpp
+++ b/proton-c/bindings/cpp/src/receiver_options.cpp
@@ -65,6 +65,7 @@ class receiver_options::impl {
option<messaging_handler*> handler;
option<proton::delivery_mode> delivery_mode;
option<bool> auto_accept;
+ option<bool> auto_settle;
option<int> credit_window;
option<bool> dynamic_address;
option<source_options> source;
@@ -76,6 +77,7 @@ class receiver_options::impl {
if (r.uninitialized()) {
if (delivery_mode.set) set_delivery_mode(r, delivery_mode.value);
if (handler.set && handler.value) container::impl::set_handler(r, handler.value);
+ if (auto_settle.set) get_context(r).auto_settle = auto_settle.value;
if (auto_accept.set) get_context(r).auto_accept = auto_accept.value;
if (credit_window.set) get_context(r).credit_window = credit_window.value;
@@ -94,6 +96,7 @@ class receiver_options::impl {
handler.update(x.handler);
delivery_mode.update(x.delivery_mode);
auto_accept.update(x.auto_accept);
+ auto_settle.update(x.auto_settle);
credit_window.update(x.credit_window);
dynamic_address.update(x.dynamic_address);
source.update(x.source);
@@ -128,4 +131,8 @@ void receiver_options::apply(receiver& r) const { impl_->apply(r); }
const std::string* receiver_options::get_name() const {
return impl_->name.set ? &impl_->name.value : 0;
}
+
+// No-op, kept for binary compat but auto_settle is not relevant to receiver only sender.
+receiver_options& receiver_options::auto_settle(bool b) { return *this; }
+
} // namespace proton
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-proton git commit: PROTON-1717 [C proactor] Make changes
backward compatible.
Posted by ac...@apache.org.
PROTON-1717 [C proactor] Make changes backward compatible.
Restore and deprecate original signatures for pn_proactor_connect and pn_listener_accept.
Introduce pn_proactor_connect2 and pn_listener_accept2 taking a transport parameter.
Update all examples & tests to use the un-deprecated functions.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3311dd60
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3311dd60
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3311dd60
Branch: refs/heads/master
Commit: 3311dd602d228e960019a54128e1e6674247778f
Parents: b9f9402
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Dec 19 14:02:33 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Dec 19 14:02:33 2017 -0500
----------------------------------------------------------------------
examples/c/broker.c | 23 ++++-----
examples/c/direct.c | 2 +-
examples/c/example_test.py | 4 +-
examples/c/receive.c | 2 +-
examples/c/send-abort.c | 2 +-
examples/c/send-ssl.c | 26 +++++++---
examples/c/send.c | 2 +-
.../cpp/src/proactor_container_impl.cpp | 4 +-
proton-c/include/proton/event.h | 2 +-
proton-c/include/proton/listener.h | 17 +++++--
proton-c/include/proton/proactor.h | 11 +++--
proton-c/src/proactor/epoll.c | 6 +--
proton-c/src/proactor/libuv.c | 4 +-
proton-c/src/proactor/proactor-internal.c | 13 +++++
proton-c/src/proactor/win_iocp.c | 4 +-
proton-c/src/tests/proactor.c | 50 ++++++++++----------
16 files changed, 105 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/examples/c/broker.c
----------------------------------------------------------------------
diff --git a/examples/c/broker.c b/examples/c/broker.c
index d5a3eef..c2efed8 100644
--- a/examples/c/broker.c
+++ b/examples/c/broker.c
@@ -290,26 +290,21 @@ static void handle(broker_t* b, pn_event_t* e) {
fflush(stdout);
break;
- case PN_LISTENER_ACCEPT:
- pn_listener_accept(pn_event_listener(e), NULL, NULL);
- break;
-
- case PN_CONNECTION_INIT:
- pn_connection_set_container(c, b->container_id);
- break;
-
- case PN_CONNECTION_BOUND: {
- /* Allow anonymous connections by SASL */
- pn_transport_t *t = pn_connection_transport(c);
+ case PN_LISTENER_ACCEPT: {
+ /* Configure a transport to allow SSL and SASL connections. See ssl_domain setup in main() */
+ pn_transport_t *t = pn_transport();
pn_transport_require_auth(t, false);
pn_sasl_allowed_mechs(pn_sasl(t), "ANONYMOUS");
- /* Accept SSL connections if possible, but also plain connections.
- See the call to pn_ssl_domain_allow_unsecured_client() in main() */
if (b->ssl_domain) {
- pn_ssl_init(pn_ssl(pn_event_transport(e)), b->ssl_domain, NULL);
+ pn_ssl_init(pn_ssl(t), b->ssl_domain, NULL);
}
+ pn_listener_accept2(pn_event_listener(e), NULL, t);
break;
}
+ case PN_CONNECTION_INIT:
+ pn_connection_set_container(c, b->container_id);
+ break;
+
case PN_CONNECTION_REMOTE_OPEN: {
pn_connection_open(pn_event_connection(e)); /* Complete the open */
break;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/examples/c/direct.c
----------------------------------------------------------------------
diff --git a/examples/c/direct.c b/examples/c/direct.c
index cf5db68..3313ab2 100644
--- a/examples/c/direct.c
+++ b/examples/c/direct.c
@@ -234,7 +234,7 @@ static bool handle(app_data_t* app, pn_event_t* event) {
break;
case PN_LISTENER_ACCEPT:
- pn_listener_accept(pn_event_listener(event), NULL, NULL);
+ pn_listener_accept2(pn_event_listener(event), NULL, NULL);
break;
case PN_CONNECTION_INIT:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/examples/c/example_test.py
----------------------------------------------------------------------
diff --git a/examples/c/example_test.py b/examples/c/example_test.py
index 782728e..1e25c76 100644
--- a/examples/c/example_test.py
+++ b/examples/c/example_test.py
@@ -119,7 +119,9 @@ class CExampleTest(ProcTestCase):
def test_send_ssl_receive(self):
"""Send first then receive"""
with Broker(self) as b:
- self.assertEqual(send_expect(), self.runex("send-ssl", b.port))
+ got = self.runex("send-ssl", b.port)
+ self.assertIn("secure connection:", got)
+ self.assertIn(send_expect(), got)
self.assertMultiLineEqual(receive_expect(), self.runex("receive", b.port))
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/examples/c/receive.c
----------------------------------------------------------------------
diff --git a/examples/c/receive.c b/examples/c/receive.c
index 8b25115..0d0c988 100644
--- a/examples/c/receive.c
+++ b/examples/c/receive.c
@@ -193,7 +193,7 @@ int main(int argc, char **argv) {
/* Create the proactor and connect */
app.proactor = pn_proactor();
pn_proactor_addr(addr, sizeof(addr), app.host, app.port);
- pn_proactor_connect(app.proactor, NULL, NULL, addr);
+ pn_proactor_connect2(app.proactor, NULL, NULL, addr);
run(&app);
pn_proactor_free(app.proactor);
return exit_code;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/examples/c/send-abort.c
----------------------------------------------------------------------
diff --git a/examples/c/send-abort.c b/examples/c/send-abort.c
index 240d459..cc88ff0 100644
--- a/examples/c/send-abort.c
+++ b/examples/c/send-abort.c
@@ -218,7 +218,7 @@ int main(int argc, char **argv) {
app.proactor = pn_proactor();
pn_proactor_addr(addr, sizeof(addr), app.host, app.port);
- pn_proactor_connect(app.proactor, NULL, NULL, addr);
+ pn_proactor_connect2(app.proactor, NULL, NULL, addr);
run(&app);
pn_proactor_free(app.proactor);
free(app.message_buffer.start);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/examples/c/send-ssl.c
----------------------------------------------------------------------
diff --git a/examples/c/send-ssl.c b/examples/c/send-ssl.c
index cc8c6d0..5d3404c 100644
--- a/examples/c/send-ssl.c
+++ b/examples/c/send-ssl.c
@@ -126,10 +126,14 @@ static bool handle(app_data_t* app, pn_event_t* event) {
}
}
- case PN_CONNECTION_BOUND: {
- int err = pn_ssl_init(pn_ssl(pn_event_transport(event)), app->ssl_domain, NULL);
- if (err) fprintf(stderr, "error encoding message: %s\n", pn_code(err));
- break;
+ case PN_CONNECTION_REMOTE_OPEN: {
+ pn_ssl_t *ssl = pn_ssl(pn_event_transport(event));
+ if (ssl) {
+ char name[1024];
+ pn_ssl_get_protocol_name(ssl, name, sizeof(name));
+ printf("secure connection: %s\n", name);
+ fflush(stdout);
+ }
}
case PN_LINK_FLOW: {
@@ -211,7 +215,8 @@ void run(app_data_t *app) {
int main(int argc, char **argv) {
struct app_data_t app = {0};
char addr[PN_MAX_ADDR];
-
+ pn_transport_t *t = NULL;
+
app.container_id = argv[0]; /* Should be unique */
app.host = (argc > 1) ? argv[1] : "";
app.port = (argc > 2) ? argv[2] : "amqp";
@@ -221,7 +226,16 @@ int main(int argc, char **argv) {
app.proactor = pn_proactor();
pn_proactor_addr(addr, sizeof(addr), app.host, app.port);
- pn_proactor_connect(app.proactor, NULL, NULL, addr);
+
+ /* Configure a transport for SSL. The transport will be freed by the proactor. */
+ t = pn_transport();
+ int err = pn_ssl_init(pn_ssl(t), app.ssl_domain, NULL);
+ if (err) {
+ fprintf(stderr, "error initializing SSL: %s\n", pn_code(err));
+ return 1;
+ }
+ pn_proactor_connect2(app.proactor, NULL, t, addr);
+
run(&app);
pn_ssl_domain_free(app.ssl_domain);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/examples/c/send.c
----------------------------------------------------------------------
diff --git a/examples/c/send.c b/examples/c/send.c
index d667828..9e8cc4a 100644
--- a/examples/c/send.c
+++ b/examples/c/send.c
@@ -196,7 +196,7 @@ int main(int argc, char **argv) {
app.proactor = pn_proactor();
pn_proactor_addr(addr, sizeof(addr), app.host, app.port);
- pn_proactor_connect(app.proactor, NULL, NULL, addr);
+ pn_proactor_connect2(app.proactor, NULL, NULL, addr);
run(&app);
pn_proactor_free(app.proactor);
free(app.message_buffer.start);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/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 25efde6..3e68c44 100644
--- a/proton-c/bindings/cpp/src/proactor_container_impl.cpp
+++ b/proton-c/bindings/cpp/src/proactor_container_impl.cpp
@@ -209,7 +209,7 @@ pn_connection_t* container::impl::make_connection_lh(
void container::impl::start_connection(const url& url, pn_connection_t *pnc) {
char caddr[PN_MAX_ADDR];
pn_proactor_addr(caddr, sizeof(caddr), url.host().c_str(), url.port().c_str());
- pn_proactor_connect(proactor_, pnc, NULL, caddr); // Takes ownership of pnc
+ pn_proactor_connect2(proactor_, pnc, NULL, caddr); // Takes ownership of pnc
}
void container::impl::reconnect(pn_connection_t* pnc) {
@@ -531,7 +531,7 @@ bool container::impl::handle(pn_event_t* event) {
cc.listener_context_ = &lc;
cc.handler = opts.handler();
cc.work_queue_ = new container::impl::connection_work_queue(*container_.impl_, c);
- pn_listener_accept(l, c, NULL);
+ pn_listener_accept2(l, c, NULL);
return false;
}
case PN_LISTENER_CLOSE: {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/include/proton/event.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/event.h b/proton-c/include/proton/event.h
index 206828b..611b65c 100644
--- a/proton-c/include/proton/event.h
+++ b/proton-c/include/proton/event.h
@@ -309,7 +309,7 @@ typedef enum {
PN_CONNECTION_WAKE,
/**
- * Indicates the listener has an incoming connection, call pn_listener_accept()
+ * Indicates the listener has an incoming connection, call pn_listener_accept2()
* to accept it.
* Events of this type point to the @ref pn_listener_t.
*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/include/proton/listener.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/listener.h b/proton-c/include/proton/listener.h
index ebe3614..9ad9ecb 100644
--- a/proton-c/include/proton/listener.h
+++ b/proton-c/include/proton/listener.h
@@ -56,16 +56,25 @@ PNP_EXTERN pn_listener_t *pn_listener(void);
PNP_EXTERN void pn_listener_free(pn_listener_t *l);
/**
- * Accept an incoming connection request on @p transport bound to @p connection.
+ * Accept an incoming connection request using @p transport and @p connection,
+ * which can be configured before the call.
+ *
* Call after a @ref PN_LISTENER_ACCEPT event.
*
+ * Errors are returned as @ref PN_TRANSPORT_CLOSED events by pn_proactor_wait().
+ *
* @param[in] listener the listener
* @param[in] connection If NULL a new connection is created.
- * Memory management is the same as for pn_proactor_connect()
+ * Memory management is the same as for pn_proactor_connect2()
* @param[in] transport If NULL a new transport is created.
- * Memory management is the same as for pn_proactor_connect()
+ * Memory management is the same as for pn_proactor_connect2()
+ */
+PNP_EXTERN void pn_listener_accept2(pn_listener_t *listener, pn_connection_t *connection, pn_transport_t *transport);
+
+/**
+ * @deprecated Equivalent to pn_listener_accept2(listener, connection, NULL)
*/
-PNP_EXTERN void pn_listener_accept(pn_listener_t *listener, pn_connection_t *connection, pn_transport_t *transport);
+PNP_EXTERN void pn_listener_accept(pn_listener_t* listener, pn_connection_t *connection);
/**
* Get the error condition for a listener.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/include/proton/proactor.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/proactor.h b/proton-c/include/proton/proactor.h
index 1d32668..3e47d99 100644
--- a/proton-c/include/proton/proactor.h
+++ b/proton-c/include/proton/proactor.h
@@ -74,7 +74,7 @@ extern "C" {
#define PN_MAX_ADDR 1060
/**
- * Format a host:port address string for pn_proactor_connect() or pn_proactor_listen()
+ * Format a host:port address string for pn_proactor_connect2() or pn_proactor_listen2()
*
* @param[out] addr address is copied to this buffer, with trailing '\0'
* @param[in] size size of addr buffer
@@ -119,7 +119,12 @@ PNP_EXTERN void pn_proactor_free(pn_proactor_t *proactor);
* An empty port will connect to the standard AMQP port (5672).
*
*/
-PNP_EXTERN void pn_proactor_connect(pn_proactor_t *proactor, pn_connection_t *connection, pn_transport_t *transport, const char *addr);
+PNP_EXTERN void pn_proactor_connect2(pn_proactor_t *proactor, pn_connection_t *connection, pn_transport_t *transport, const char *addr);
+
+/**
+ * @deprecated Equivalent to pn_proactor_connect2(proactor, connection, NULL, addr)
+ */
+PNP_EXTERN void pn_proactor_connect(pn_proactor_t *proactor, pn_connection_t *connection, const char *addr);
/**
* Start listening for incoming connections.
@@ -250,7 +255,7 @@ PNP_EXTERN void pn_proactor_cancel_timeout(pn_proactor_t *proactor);
* and so on) remain intact, but the transport is closed and unbound. The
* proactor will not return any more events for this connection. The caller must
* call pn_connection_free(), either directly or indirectly by re-using @p
- * connection in another call to pn_proactor_connect() or pn_proactor_listen().
+ * connection in another call to pn_proactor_connect2() or pn_proactor_listen2().
*
* @note **Not thread-safe**. Call this function from a connection
* event handler.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/src/proactor/epoll.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/epoll.c b/proton-c/src/proactor/epoll.c
index ff515b1..84986f2 100644
--- a/proton-c/src/proactor/epoll.c
+++ b/proton-c/src/proactor/epoll.c
@@ -1294,7 +1294,7 @@ static bool wake_if_inactive(pn_proactor_t *p) {
return false;
}
-void pn_proactor_connect(pn_proactor_t *p, pn_connection_t *c, pn_transport_t *t, const char *addr) {
+void pn_proactor_connect2(pn_proactor_t *p, pn_connection_t *c, pn_transport_t *t, const char *addr) {
pconnection_t *pc = (pconnection_t*) pn_class_new(&pconnection_class, sizeof(pconnection_t));
assert(pc); // TODO: memory safety
const char *err = pconnection_setup(pc, p, c, t, false, addr);
@@ -1537,7 +1537,7 @@ static void listener_begin_close(pn_listener_t* l) {
unlock(&l->rearm_mutex);
}
}
- /* Close all sockets waiting for a pn_listener_accept() */
+ /* Close all sockets waiting for a pn_listener_accept2() */
if (l->unclaimed) l->pending_count++;
acceptor_t *a = listener_list_next(&l->pending_acceptors);
while (a) {
@@ -1697,7 +1697,7 @@ pn_record_t *pn_listener_attachments(pn_listener_t *l) {
return l->attachments;
}
-void pn_listener_accept(pn_listener_t *l, pn_connection_t *c, pn_transport_t *t) {
+void pn_listener_accept2(pn_listener_t *l, pn_connection_t *c, pn_transport_t *t) {
pconnection_t *pc = (pconnection_t*) pn_class_new(&pconnection_class, sizeof(pconnection_t));
assert(pc); // TODO: memory safety
const char *err = pconnection_setup(pc, pn_listener_proactor(l), c, t, true, "");
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/src/proactor/libuv.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/libuv.c b/proton-c/src/proactor/libuv.c
index 6f13040..7be83fe 100644
--- a/proton-c/src/proactor/libuv.c
+++ b/proton-c/src/proactor/libuv.c
@@ -1115,7 +1115,7 @@ void pn_proactor_cancel_timeout(pn_proactor_t *p) {
uv_mutex_unlock(&p->lock);
}
-void pn_proactor_connect(pn_proactor_t *p, pn_connection_t *c, pn_transport_t *t, const char *addr) {
+void pn_proactor_connect2(pn_proactor_t *p, pn_connection_t *c, pn_transport_t *t, const char *addr) {
pconnection_t *pc = pconnection(p, c, t, false);
assert(pc); /* TODO aconway 2017-03-31: memory safety */
pn_connection_open(pc->driver.connection); /* Auto-open */
@@ -1270,7 +1270,7 @@ pn_record_t *pn_listener_attachments(pn_listener_t *l) {
return l->attachments;
}
-void pn_listener_accept(pn_listener_t *l, pn_connection_t *c, pn_transport_t *t) {
+void pn_listener_accept2(pn_listener_t *l, pn_connection_t *c, pn_transport_t *t) {
uv_mutex_lock(&l->lock);
pconnection_t *pc = pconnection(l->work.proactor, c, t, true);
assert(pc);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/src/proactor/proactor-internal.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/proactor-internal.c b/proton-c/src/proactor/proactor-internal.c
index d870e77..f3f834a 100644
--- a/proton-c/src/proactor/proactor-internal.c
+++ b/proton-c/src/proactor/proactor-internal.c
@@ -22,6 +22,7 @@
#include "proactor-internal.h"
#include <proton/error.h>
+#include <proton/listener.h>
#include <proton/proactor.h>
#include <stdio.h>
@@ -83,3 +84,15 @@ void pni_proactor_set_cond(
msg, what, nonull(host), nonull(port));
}
}
+
+// Backwards compatibility signatures.
+
+void pn_proactor_connect(pn_proactor_t *p, pn_connection_t *c, const char *addr) {
+ pn_proactor_connect2(p, c, NULL, addr);
+}
+
+void pn_listener_accept(pn_listener_t *l, pn_connection_t *c) {
+ pn_listener_accept2(l, c, NULL);
+}
+
+
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/src/proactor/win_iocp.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/win_iocp.c b/proton-c/src/proactor/win_iocp.c
index 679b045..0be4b51 100644
--- a/proton-c/src/proactor/win_iocp.c
+++ b/proton-c/src/proactor/win_iocp.c
@@ -2715,7 +2715,7 @@ static void connect_step_done(pconnection_t *pc, connect_result_t *result) {
}
}
-void pn_proactor_connect(pn_proactor_t *p, pn_connection_t *c, pn_transport_t *t, const char *addr) {
+void pn_proactor_connect2(pn_proactor_t *p, pn_connection_t *c, pn_transport_t *t, const char *addr) {
pconnection_t *pc = (pconnection_t*) pn_class_new(&pconnection_class, sizeof(pconnection_t));
assert(pc); // TODO: memory safety
const char *err = pconnection_setup(pc, p, c, t, false, addr);
@@ -3156,7 +3156,7 @@ static void recycle_result(accept_result_t *accept_result) {
}
}
-void pn_listener_accept(pn_listener_t *l, pn_connection_t *c, pn_transport_t *t) {
+void pn_listener_accept2(pn_listener_t *l, pn_connection_t *c, pn_transport_t *t) {
accept_result_t *accept_result = NULL;
DWORD err = 0;
psocket_t *ps = NULL;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3311dd60/proton-c/src/tests/proactor.c
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/proactor.c b/proton-c/src/tests/proactor.c
index 332a73a..844cf95 100644
--- a/proton-c/src/tests/proactor.c
+++ b/proton-c/src/tests/proactor.c
@@ -207,7 +207,7 @@ static pn_event_type_t common_handler(test_handler_t *th, pn_event_t *e) {
case PN_LISTENER_ACCEPT:
last_accepted = pn_connection();
- pn_listener_accept(l, last_accepted, NULL);
+ pn_listener_accept2(l, last_accepted, NULL);
pn_listener_close(l); /* Only accept one connection */
return PN_EVENT_NONE;
@@ -257,7 +257,7 @@ static pn_event_type_t listen_handler(test_handler_t *th, pn_event_t *e) {
case PN_LISTENER_ACCEPT:
/* No automatic listener close/free for tests that accept multiple connections */
last_accepted = pn_connection();
- pn_listener_accept(pn_event_listener(e), last_accepted, NULL);
+ pn_listener_accept2(pn_event_listener(e), last_accepted, NULL);
/* No automatic close */
return PN_EVENT_NONE;
@@ -285,7 +285,7 @@ static void test_client_server(test_t *t) {
test_proactor_t tps[] ={ test_proactor(t, open_close_handler), test_proactor(t, common_handler) };
test_listener_t l = test_listen(&tps[1], localhost);
/* Connect and wait for close at both ends */
- pn_proactor_connect(tps[0].proactor, NULL, NULL, l.port.host_port);
+ pn_proactor_connect2(tps[0].proactor, NULL, NULL, l.port.host_port);
TEST_PROACTORS_RUN_UNTIL(tps, PN_TRANSPORT_CLOSED);
TEST_PROACTORS_RUN_UNTIL(tps, PN_TRANSPORT_CLOSED);
TEST_PROACTORS_DESTROY(tps);
@@ -312,7 +312,7 @@ static void test_connection_wake(test_t *t) {
pn_connection_t *c = pn_connection();
pn_incref(c); /* Keep a reference for wake() after free */
- pn_proactor_connect(client, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
TEST_CHECK(t, pn_proactor_get(client) == NULL); /* Should be idle */
pn_connection_wake(c);
@@ -325,7 +325,7 @@ static void test_connection_wake(test_t *t) {
/* Verify we don't get a wake after close even if they happen together */
pn_connection_t *c2 = pn_connection();
- pn_proactor_connect(client, c2, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c2, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
pn_connection_wake(c2);
pn_proactor_disconnect(client, NULL);
@@ -361,7 +361,7 @@ static void test_abort(test_t *t) {
test_proactor_t tps[] = { test_proactor(t, open_close_handler), test_proactor(t, listen_abort_handler) };
pn_proactor_t *client = tps[0].proactor;
test_listener_t l = test_listen(&tps[1], localhost);
- pn_proactor_connect(client, NULL, NULL, l.port.host_port);
+ pn_proactor_connect2(client, NULL, NULL, l.port.host_port);
/* server transport closes */
if (TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps))) {
@@ -420,7 +420,7 @@ static void test_refuse(test_t *t) {
test_proactor_t tps[] = { test_proactor(t, open_close_handler), test_proactor(t, listen_refuse_handler) };
pn_proactor_t *client = tps[0].proactor;
test_listener_t l = test_listen(&tps[1], localhost);
- pn_proactor_connect(client, NULL, NULL, l.port.host_port);
+ pn_proactor_connect2(client, NULL, NULL, l.port.host_port);
/* client transport closes */
TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps)); /* client */
@@ -458,7 +458,7 @@ static void test_inactive(test_t *t) {
/* Listen, connect, disconnect */
test_listener_t l = test_listen(&tps[1], localhost);
pn_connection_t *c = pn_connection();
- pn_proactor_connect(client, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
pn_connection_wake(c);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_WAKE, TEST_PROACTORS_RUN(tps));
@@ -475,7 +475,7 @@ static void test_inactive(test_t *t) {
/* Connect, set-timer, disconnect */
pn_proactor_set_timeout(client, 1000000);
c = pn_connection();
- pn_proactor_connect(client, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
pn_connection_wake(c);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_WAKE, TEST_PROACTORS_RUN(tps));
@@ -503,7 +503,7 @@ static void test_errors(test_t *t) {
/* Invalid connect/listen service name */
pn_connection_t *c = pn_connection();
- pn_proactor_connect(client, c, NULL, "127.0.0.1:xxx");
+ pn_proactor_connect2(client, c, NULL, "127.0.0.1:xxx");
TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps));
TEST_COND_DESC(t, "xxx", last_condition);
TEST_ETYPE_EQUAL(t, PN_PROACTOR_INACTIVE, TEST_PROACTORS_RUN(tps));
@@ -516,7 +516,7 @@ static void test_errors(test_t *t) {
/* Invalid connect/listen host name */
c = pn_connection();
- pn_proactor_connect(client, c, NULL, "nosuch.example.com:");
+ pn_proactor_connect2(client, c, NULL, "nosuch.example.com:");
TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps));
TEST_COND_DESC(t, "nosuch", last_condition);
TEST_ETYPE_EQUAL(t, PN_PROACTOR_INACTIVE, TEST_PROACTORS_RUN(tps));
@@ -544,7 +544,7 @@ static void test_errors(test_t *t) {
/* Connect with no listener */
c = pn_connection();
- pn_proactor_connect(client, c, NULL, port.host_port);
+ pn_proactor_connect2(client, c, NULL, port.host_port);
if (TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps))) {
TEST_COND_DESC(t, "refused", last_condition);
TEST_ETYPE_EQUAL(t, PN_PROACTOR_INACTIVE, TEST_PROACTORS_RUN(tps));
@@ -573,7 +573,7 @@ static pn_event_type_t transport_close_connection_handler(test_handler_t *th, pn
*/
static void test_proton_1586(test_t *t) {
test_proactor_t tps[] = { test_proactor(t, transport_close_connection_handler) };
- pn_proactor_connect(tps[0].proactor, NULL, NULL, ":yyy");
+ pn_proactor_connect2(tps[0].proactor, NULL, NULL, ":yyy");
TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps));
TEST_COND_DESC(t, ":yyy", last_condition);
test_handler_clear(&tps[0].handler, 0); /* Clear events */
@@ -598,7 +598,7 @@ static void test_ipv4_ipv6(test_t *t) {
TEST_PROACTORS_DRAIN(tps);
#define EXPECT_CONNECT(TP, HOST) do { \
- pn_proactor_connect(client, NULL, NULL, test_port_use_host(&(TP), (HOST))); \
+ pn_proactor_connect2(client, NULL, NULL, test_port_use_host(&(TP), (HOST))); \
TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps)); \
TEST_COND_EMPTY(t, last_condition); \
TEST_PROACTORS_DRAIN(tps); \
@@ -645,12 +645,12 @@ static void test_release_free(test_t *t) {
test_listener_t l = test_listen(&tps[1], localhost);
/* leave one connection to the proactor */
- pn_proactor_connect(client, NULL, NULL, l.port.host_port);
+ pn_proactor_connect2(client, NULL, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
/* release c1 and free immediately */
pn_connection_t *c1 = pn_connection();
- pn_proactor_connect(client, c1, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c1, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
pn_proactor_release_connection(c1); /* We free but socket should still be cleaned up */
pn_connection_free(c1);
@@ -659,7 +659,7 @@ static void test_release_free(test_t *t) {
/* release c2 and but don't free till after proactor free */
pn_connection_t *c2 = pn_connection();
- pn_proactor_connect(client, c2, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c2, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
pn_proactor_release_connection(c2);
TEST_CHECK(t, pn_proactor_get(client) == NULL); /* Should be idle */
@@ -750,7 +750,7 @@ static void test_ssl(test_t *t) {
test_listener_t l = test_listen(server, localhost);
/* Basic SSL connection */
- pn_proactor_connect(client->proactor, NULL, NULL, l.port.host_port);
+ pn_proactor_connect2(client->proactor, NULL, NULL, l.port.host_port);
/* Open ok at both ends */
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
TEST_COND_EMPTY(t, last_condition);
@@ -764,7 +764,7 @@ static void test_ssl(test_t *t) {
TEST_INT_EQUAL(t, 0, pn_ssl_domain_set_peer_authentication(cd, PN_SSL_VERIFY_PEER_NAME, NULL));
pn_connection_t *c = pn_connection();
pn_connection_set_hostname(c, "test_server");
- pn_proactor_connect(client->proactor, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client->proactor, c, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
TEST_COND_EMPTY(t, last_condition);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
@@ -775,7 +775,7 @@ static void test_ssl(test_t *t) {
/* Verify peer with bad hostname */
c = pn_connection();
pn_connection_set_hostname(c, "wrongname");
- pn_proactor_connect(client->proactor, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client->proactor, c, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_TRANSPORT_CLOSED, TEST_PROACTORS_RUN(tps));
TEST_COND_NAME(t, "amqp:connection:framing-error", last_condition);
TEST_COND_DESC(t, "SSL", last_condition);
@@ -854,7 +854,7 @@ static void test_netaddr(test_t *t) {
/* Use IPv4 to get consistent results all platforms */
test_listener_t l = test_listen(&tps[1], "127.0.0.1");
pn_connection_t *c = pn_connection();
- pn_proactor_connect(client, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c, NULL, l.port.host_port);
if (!TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps))) {
TEST_COND_EMPTY(t, last_condition); /* Show the last condition */
return; /* don't continue if connection is closed */
@@ -910,10 +910,10 @@ static void test_disconnect(test_t *t) {
/* Only wait for one connection to remote-open before disconnect */
pn_connection_t *c = pn_connection();
- pn_proactor_connect(client, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c, NULL, l.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
pn_connection_t *c2 = pn_connection();
- pn_proactor_connect(client, c2, NULL, l2.port.host_port);
+ pn_proactor_connect2(client, c2, NULL, l2.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
TEST_PROACTORS_DRAIN(tps);
@@ -945,7 +945,7 @@ static void test_disconnect(test_t *t) {
/* Make sure the proactors are still functional */
test_listener_t l3 = test_listen(&tps[1], localhost);
- pn_proactor_connect(client, NULL, NULL, l3.port.host_port);
+ pn_proactor_connect2(client, NULL, NULL, l3.port.host_port);
TEST_ETYPE_EQUAL(t, PN_CONNECTION_REMOTE_OPEN, TEST_PROACTORS_RUN(tps));
pn_proactor_disconnect(client, NULL);
@@ -1042,7 +1042,7 @@ static void test_message_stream(test_t *t) {
pn_message_free(m);
pn_connection_t *c = pn_connection();
- pn_proactor_connect(client, c, NULL, l.port.host_port);
+ pn_proactor_connect2(client, c, NULL, l.port.host_port);
pn_session_t *ssn = pn_session(c);
pn_session_open(ssn);
pn_link_t *snd = pn_sender(ssn, "x");
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org