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/04/25 23:25:24 UTC
[1/3] qpid-proton git commit: PROTON-1463: Golang AMQP URL
incompatable with Qpid Cpp Broker.
Repository: qpid-proton
Updated Branches:
refs/heads/master 5eaf6666d -> a61f50e94
PROTON-1463: Golang AMQP URL incompatable with Qpid Cpp Broker.
According to https://tools.ietf.org/html/rfc3986 (and python urlparse) the Go
parser is correct to include the leading "/" in a URL path, the proton URL
parser in proton's other bindings is non-standard here.
We want to reduce confusion and move towards standard behavior so instead of
changing the URL class I updated the examples to remove the leading "/" like this:
addr := strings.TrimPrefix("/", url.Path)
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a61f50e9
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a61f50e9
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a61f50e9
Branch: refs/heads/master
Commit: a61f50e94ceb74ed81665192e1d3051ec8be0208
Parents: cd5e695
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Apr 25 19:17:17 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Apr 25 19:25:02 2017 -0400
----------------------------------------------------------------------
examples/go/electron/receive.go | 4 +++-
examples/go/electron/send.go | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a61f50e9/examples/go/electron/receive.go
----------------------------------------------------------------------
diff --git a/examples/go/electron/receive.go b/examples/go/electron/receive.go
index e48d53c..c2ba1d1 100644
--- a/examples/go/electron/receive.go
+++ b/examples/go/electron/receive.go
@@ -26,6 +26,7 @@ import (
"os"
"qpid.apache.org/amqp"
"qpid.apache.org/electron"
+ "strings"
"sync"
)
@@ -75,7 +76,8 @@ func main() {
c, err := container.Dial("tcp", url.Host)
fatalIf(err)
connections <- c // Save connection so we can Close() when main() ends
- r, err := c.Receiver(electron.Source(url.Path))
+ addr := strings.TrimPrefix("/", url.Path)
+ r, err := c.Receiver(electron.Source(addr))
fatalIf(err)
// Loop receiving messages and sending them to the main() goroutine
for {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a61f50e9/examples/go/electron/send.go
----------------------------------------------------------------------
diff --git a/examples/go/electron/send.go b/examples/go/electron/send.go
index 91cff28..033abab 100644
--- a/examples/go/electron/send.go
+++ b/examples/go/electron/send.go
@@ -26,6 +26,7 @@ import (
"os"
"qpid.apache.org/amqp"
"qpid.apache.org/electron"
+ "strings"
"sync"
)
@@ -74,12 +75,13 @@ func main() {
c, err := container.Dial("tcp", url.Host)
fatalIf(err)
connections <- c // Save connection so we can Close() when main() ends
- s, err := c.Sender(electron.Target(url.Path))
+ addr := strings.TrimPrefix("/", url.Path)
+ s, err := c.Sender(electron.Target(addr))
fatalIf(err)
// Loop sending messages.
for i := int64(0); i < *count; i++ {
m := amqp.NewMessage()
- body := fmt.Sprintf("%v%v", url.Path, i)
+ body := fmt.Sprintf("%v%v", addr, i)
m.Marshal(body)
s.SendAsync(m, sentChan, body) // Outcome will be sent to sentChan
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/3] qpid-proton git commit: PROTON-1469: c libuv proactor on_write
called after transport close
Posted by ac...@apache.org.
PROTON-1469: c libuv proactor on_write called after transport close
on_write() checks that the transport is not write-closed before calling
write_done.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c8f9a2ec
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c8f9a2ec
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c8f9a2ec
Branch: refs/heads/master
Commit: c8f9a2ec895b392b41888ea8959a0a98ca7c03e3
Parents: 5eaf666
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Apr 25 16:28:11 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Apr 25 19:25:02 2017 -0400
----------------------------------------------------------------------
proton-c/src/core/connection_driver.c | 3 +--
proton-c/src/proactor/libuv.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c8f9a2ec/proton-c/src/core/connection_driver.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/connection_driver.c b/proton-c/src/core/connection_driver.c
index f944a68..0c520da 100644
--- a/proton-c/src/core/connection_driver.c
+++ b/proton-c/src/core/connection_driver.c
@@ -111,8 +111,7 @@ pn_bytes_t pn_connection_driver_write_buffer(pn_connection_driver_t *d) {
}
void pn_connection_driver_write_done(pn_connection_driver_t *d, size_t n) {
- if (n > 0)
- pn_transport_pop(d->transport, n);
+ pn_transport_pop(d->transport, n);
}
bool pn_connection_driver_write_closed(pn_connection_driver_t *d) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c8f9a2ec/proton-c/src/proactor/libuv.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/libuv.c b/proton-c/src/proactor/libuv.c
index 66b0866..3631e8b 100644
--- a/proton-c/src/proactor/libuv.c
+++ b/proton-c/src/proactor/libuv.c
@@ -742,7 +742,7 @@ static void on_write(uv_write_t* write, int err) {
pc->writing = 0;
if (err) {
pconnection_error(pc, err, "on write to");
- } else {
+ } else if (!pn_connection_driver_write_closed(&pc->driver)) {
pn_connection_driver_write_done(&pc->driver, size);
}
work_notify(&pc->work);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/3] qpid-proton git commit: PROTON-1469: c libuv - read/write error
closes full transport
Posted by ac...@apache.org.
PROTON-1469: c libuv - read/write error closes full transport
read/write errors now only close the read/write half of the transport to allow
outstanding work to complete on the other half.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cd5e695f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cd5e695f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cd5e695f
Branch: refs/heads/master
Commit: cd5e695f3604c0ef964eaad6462058e5d599765e
Parents: c8f9a2e
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Apr 25 16:35:10 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Apr 25 19:25:02 2017 -0400
----------------------------------------------------------------------
proton-c/src/proactor/libuv.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cd5e695f/proton-c/src/proactor/libuv.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/libuv.c b/proton-c/src/proactor/libuv.c
index 3631e8b..4992b40 100644
--- a/proton-c/src/proactor/libuv.c
+++ b/proton-c/src/proactor/libuv.c
@@ -424,23 +424,33 @@ static pconnection_t *get_pconnection(pn_connection_t* c) {
return (pconnection_t*) pn_record_get(r, PN_PROACTOR);
}
+/* Remember the first error code from a bad connect attempt.
+ * This is not yet a full-blown error as we might succeed connecting
+ * to a different address if there are several.
+ */
static inline void pconnection_bad_connect(pconnection_t *pc, int err) {
if (!pc->connected) {
pc->connected = err; /* Remember first connect error in case they all fail */
}
}
-static void pconnection_error(pconnection_t *pc, int err, const char* what) {
- assert(err);
- pconnection_bad_connect(pc, err);
+/* Set the error condition, but don't close the driver. */
+static void pconnection_set_error(pconnection_t *pc, int err, const char* what) {
pn_connection_driver_t *driver = &pc->driver;
- pn_connection_driver_bind(driver); /* Bind so errors will be reported */
+ pn_connection_driver_bind(driver); /* Make sure we are bound so errors will be reported */
if (!pn_condition_is_set(pn_transport_condition(driver->transport))) {
pn_connection_driver_errorf(driver, uv_err_name(err), "%s %s:%s: %s",
what, pc->addr.host, pc->addr.port,
uv_strerror(err));
}
- pn_connection_driver_close(driver);
+}
+
+/* Set the error condition and close the driver. */
+static void pconnection_error(pconnection_t *pc, int err, const char* what) {
+ assert(err);
+ pconnection_bad_connect(pc, err);
+ pconnection_set_error(pc, err, what);
+ pn_connection_driver_close(&pc->driver);
}
static void listener_error_lh(pn_listener_t *l, int err, const char* what) {
@@ -726,12 +736,13 @@ static void on_tick(uv_timer_t *timer) {
static void on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) {
pconnection_t *pc = (pconnection_t*)stream->data;
- if (nread >= 0) {
+ if (nread > 0) {
pn_connection_driver_read_done(&pc->driver, nread);
- } else if (nread == UV_EOF) { /* hangup */
+ } else if (nread < 0) {
+ if (nread != UV_EOF) { /* hangup */
+ pconnection_set_error(pc, nread, "on read from");
+ }
pn_connection_driver_read_close(&pc->driver);
- } else {
- pconnection_error(pc, nread, "on read from");
}
work_notify(&pc->work);
}
@@ -741,7 +752,8 @@ static void on_write(uv_write_t* write, int err) {
size_t size = pc->writing;
pc->writing = 0;
if (err) {
- pconnection_error(pc, err, "on write to");
+ pconnection_set_error(pc, err, "on write to");
+ pn_connection_driver_write_close(&pc->driver);
} else if (!pn_connection_driver_write_closed(&pc->driver)) {
pn_connection_driver_write_done(&pc->driver, size);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org