From f69b4c1da69d1e9c513ad63da488a49b6b46a706 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 15 May 2018 15:43:10 -0700 Subject: fixes #436 fix for 429 incomplete (ws ep crash) While here, there is a little more endpoint termination hardening. Running this code base seems to not incur any faults beyond the very rare TCP port conflict that can occur from our random port selection in the test suite. --- src/core/endpt.c | 12 ++++++------ src/supplemental/http/http_client.c | 2 +- tests/message.c | 4 ---- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/core/endpt.c b/src/core/endpt.c index d39824a4..9fc26cf3 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -94,13 +94,13 @@ nni_ep_destroy(nni_ep *ep) nni_idhash_remove(nni_eps, ep->ep_id); } - nni_sock_ep_remove(ep->ep_sock, ep); - nni_aio_stop(ep->ep_acc_aio); nni_aio_stop(ep->ep_con_aio); nni_aio_stop(ep->ep_con_syn); nni_aio_stop(ep->ep_tmo_aio); + nni_sock_ep_remove(ep->ep_sock, ep); + nni_aio_fini(ep->ep_acc_aio); nni_aio_fini(ep->ep_con_aio); nni_aio_fini(ep->ep_con_syn); @@ -247,10 +247,10 @@ nni_ep_shutdown(nni_ep *ep) nni_mtx_unlock(&ep->ep_mtx); // Abort any remaining in-flight operations. - nni_aio_close(ep->ep_acc_aio); - nni_aio_close(ep->ep_con_aio); - nni_aio_close(ep->ep_con_syn); - nni_aio_close(ep->ep_tmo_aio); + nni_aio_stop(ep->ep_acc_aio); + nni_aio_stop(ep->ep_con_aio); + nni_aio_stop(ep->ep_con_syn); + nni_aio_stop(ep->ep_tmo_aio); // Stop the underlying transport. ep->ep_ops.ep_close(ep->ep_data); diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c index aba72715..4034bbff 100644 --- a/src/supplemental/http/http_client.c +++ b/src/supplemental/http/http_client.c @@ -246,7 +246,7 @@ nni_http_client_connect(nni_http_client *c, nni_aio *aio) return; } nni_mtx_lock(&c->mtx); - if ((rv = nni_aio_schedule(aio, http_connect_cancel, aio)) != 0) { + if ((rv = nni_aio_schedule(aio, http_connect_cancel, c)) != 0) { nni_mtx_unlock(&c->mtx); nni_aio_finish_error(aio, rv); return; diff --git a/tests/message.c b/tests/message.c index d680c100..e9f990ae 100644 --- a/tests/message.c +++ b/tests/message.c @@ -18,7 +18,6 @@ TestMain("Message Tests", { nng_msg *msg; Convey("Given an empty message", { - So(nng_msg_alloc(&msg, 0) == 0); Reset({ nng_msg_free(msg); }); @@ -217,7 +216,6 @@ TestMain("Message Tests", { So(nng_msg_trim_u32(msg, &v) == NNG_EINVAL); So(nng_msg_trim_u32(msg, &v) == NNG_EINVAL); }); - }); Convey("Uint32 header operations work", { @@ -249,8 +247,6 @@ TestMain("Message Tests", { So(nng_msg_header_trim_u32(msg, &v) == NNG_EINVAL); }); - }); - }); }) -- cgit v1.2.3-70-g09d2