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/10/25 14:49:10 UTC
qpid-proton git commit: PROTON-1255: Remove pn_connection_engine_start
Repository: qpid-proton
Updated Branches:
refs/heads/master 79e48484d -> 507c93566
PROTON-1255: Remove pn_connection_engine_start
Bind the connection automatically in pn_connection_engine_dispatch after the
user has processed the PN_CONNECTION_INIT event. This removes the need to
manually call start and allows user handlers to set security settings
in their handler on PN_CONNECTION_INIT, before the bind.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/507c9356
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/507c9356
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/507c9356
Branch: refs/heads/master
Commit: 507c9356692858a81916a4a8802fbc6b2302bc5f
Parents: 79e4848
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Oct 25 10:45:46 2016 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 25 10:45:46 2016 -0400
----------------------------------------------------------------------
proton-c/bindings/cpp/src/io/connection_engine.cpp | 1 -
.../bindings/go/src/qpid.apache.org/proton/engine.go | 1 -
proton-c/include/proton/connection_engine.h | 6 ------
proton-c/src/engine/connection_engine.c | 13 ++++---------
4 files changed, 4 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/507c9356/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 d3f2667..4712b3e 100644
--- a/proton-c/bindings/cpp/src/io/connection_engine.cpp
+++ b/proton-c/bindings/cpp/src/io/connection_engine.cpp
@@ -65,7 +65,6 @@ void connection_engine::configure(const connection_options& opts) {
opts.apply_bound(c);
handler_ = opts.handler();
connection_context::get(connection()).collector = c_engine_.collector;
- pn_connection_engine_start(&c_engine_);
}
connection_engine::~connection_engine() {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/507c9356/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go b/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
index a0b8888..5680010 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
@@ -283,7 +283,6 @@ func (eng *Engine) readBuffer() []byte {
// disconnected. You can check for errors after exit with Engine.Error().
//
func (eng *Engine) Run() error {
- C.pn_connection_engine_start(&eng.engine)
// Channels for read and write buffers going in and out of the read/write goroutines.
// The channels are unbuffered: we want to exchange buffers in seuquence.
readsIn, writesIn := make(chan []byte), make(chan []byte)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/507c9356/proton-c/include/proton/connection_engine.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/connection_engine.h b/proton-c/include/proton/connection_engine.h
index b1476c7..d9df77b 100644
--- a/proton-c/include/proton/connection_engine.h
+++ b/proton-c/include/proton/connection_engine.h
@@ -87,18 +87,12 @@ typedef struct pn_connection_engine_t {
/// Initialize a pn_connection_engine_t struct with a new connection and
/// transport.
///
-/// Configure connection properties and call connection_engine_start() before
-/// using the engine.
-///
/// Call pn_connection_engine_final to free resources when you are done.
///
///@return 0 on success, a proton error code on failure (@see error.h)
///
PN_EXTERN int pn_connection_engine_init(pn_connection_engine_t* engine);
-/// Start the engine, call after setting security and host properties.
-PN_EXTERN void pn_connection_engine_start(pn_connection_engine_t* engine);
-
/// Free resources used by the engine, set the connection and transport pointers
/// to NULL.
PN_EXTERN void pn_connection_engine_final(pn_connection_engine_t* engine);
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/507c9356/proton-c/src/engine/connection_engine.c
----------------------------------------------------------------------
diff --git a/proton-c/src/engine/connection_engine.c b/proton-c/src/engine/connection_engine.c
index adfb145..5d184a1 100644
--- a/proton-c/src/engine/connection_engine.c
+++ b/proton-c/src/engine/connection_engine.c
@@ -36,14 +36,6 @@ int pn_connection_engine_init(pn_connection_engine_t* e) {
return PN_OK;
}
-void pn_connection_engine_start(pn_connection_engine_t* e) {
- /*
- Ignore bind errors. PN_STATE_ERR means we are already bound, any
- other error will be delivered as an event.
- */
- pn_transport_bind(e->transport, e->connection);
-}
-
void pn_connection_engine_final(pn_connection_engine_t* e) {
if (e->transport && e->connection) {
pn_transport_unbind(e->transport);
@@ -105,8 +97,11 @@ static void log_event(pn_connection_engine_t *engine, pn_event_t* event) {
}
pn_event_t* pn_connection_engine_dispatch(pn_connection_engine_t* e) {
- if (e->event)
+ if (e->event) { /* Already returned */
+ if (pn_event_type(e->event) == PN_CONNECTION_INIT)
+ pn_transport_bind(e->transport, e->connection);
pn_collector_pop(e->collector);
+ }
e->event = pn_collector_peek(e->collector);
log_event(e, e->event);
return e->event;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org