diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-08-23 13:20:24 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-08-23 21:14:19 -0700 |
| commit | 2ec64a78da8df01ec534161475a87989ae527776 (patch) | |
| tree | 430d4289ca56e123cf2b2be76cf90a6c346bf27c /src/transport/ipc | |
| parent | 8ad296769192cf4628710ac0b228be2aca6d8dad (diff) | |
| download | nng-2ec64a78da8df01ec534161475a87989ae527776.tar.gz nng-2ec64a78da8df01ec534161475a87989ae527776.tar.bz2 nng-2ec64a78da8df01ec534161475a87989ae527776.zip | |
The common endpoint code already ensures state is proper.
This eliminates tests for code that we cannot reach, because the
upper layer endpoint code already ensures that we don't get called
if we are closing, that the mode is correct, and that only one
outstanding endpoint operation is in progress on any given endpoint.
Diffstat (limited to 'src/transport/ipc')
| -rw-r--r-- | src/transport/ipc/ipc.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c index 3430ceb3..4324eedd 100644 --- a/src/transport/ipc/ipc.c +++ b/src/transport/ipc/ipc.c @@ -49,7 +49,6 @@ struct nni_ipc_pipe { struct nni_ipc_ep { char addr[NNG_MAXADDRLEN + 1]; nni_plat_ipc_ep *iep; - int closed; uint16_t proto; size_t rcvmax; nni_aio aio; @@ -510,8 +509,7 @@ nni_ipc_ep_init(void **epp, const char *url, nni_sock *sock, int mode) nni_mtx_init(&ep->mtx); nni_aio_init(&ep->aio, nni_ipc_ep_cb, ep); - ep->closed = 0; - ep->proto = nni_sock_proto(sock); + ep->proto = nni_sock_proto(sock); (void) snprintf(ep->addr, sizeof(ep->addr), "%s", url); *epp = ep; @@ -524,7 +522,6 @@ nni_ipc_ep_close(void *arg) nni_ipc_ep *ep = arg; nni_mtx_lock(&ep->mtx); - ep->closed = 1; nni_plat_ipc_ep_close(ep->iep); nni_mtx_unlock(&ep->mtx); @@ -538,11 +535,7 @@ nni_ipc_ep_bind(void *arg) int rv; nni_mtx_lock(&ep->mtx); - if (ep->closed) { - rv = NNG_ECLOSED; - } else { - rv = nni_plat_ipc_ep_listen(ep->iep); - } + rv = nni_plat_ipc_ep_listen(ep->iep); nni_mtx_unlock(&ep->mtx); return (rv); } @@ -621,16 +614,10 @@ nni_ipc_ep_accept(void *arg, nni_aio *aio) NNI_ASSERT(ep->user_aio == NULL); if ((rv = nni_aio_start(aio, nni_ipc_cancel_ep, ep)) != 0) { - ep->user_aio = NULL; nni_mtx_unlock(&ep->mtx); return; } - if (ep->closed) { - nni_aio_finish(aio, NNG_ECLOSED, 0); - nni_mtx_unlock(&ep->mtx); - return; - } ep->user_aio = aio; nni_plat_ipc_ep_accept(ep->iep, &ep->aio); @@ -652,12 +639,6 @@ nni_ipc_ep_connect(void *arg, nni_aio *aio) return; } - if (ep->closed) { - nni_aio_finish(aio, NNG_ECLOSED, 0); - nni_mtx_unlock(&ep->mtx); - return; - } - ep->user_aio = aio; nni_plat_ipc_ep_connect(ep->iep, &ep->aio); |
