diff options
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/posix/posix_epdesc.c | 6 | ||||
| -rw-r--r-- | src/platform/windows/win_iocp.c | 11 | ||||
| -rw-r--r-- | src/platform/windows/win_ipc.c | 8 | ||||
| -rw-r--r-- | src/platform/windows/win_net.c | 5 |
4 files changed, 20 insertions, 10 deletions
diff --git a/src/platform/posix/posix_epdesc.c b/src/platform/posix/posix_epdesc.c index a6de29e1..8cae2565 100644 --- a/src/platform/posix/posix_epdesc.c +++ b/src/platform/posix/posix_epdesc.c @@ -1,5 +1,6 @@ // // Copyright 2017 Garrett D'Amore <garrett@damore.org> +// Copyright 2017 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -72,8 +73,9 @@ nni_posix_epdesc_finish(nni_aio *aio, int rv, int newfd) aio->a_pipe = pd; } } - // Abuse the count to hold our new fd. This is only for accept. - nni_aio_finish(aio, rv, 0); + if ((nni_aio_finish(aio, rv, 0) != 0) && (rv == 0)) { + nni_posix_pipedesc_fini(pd); + } } static void diff --git a/src/platform/windows/win_iocp.c b/src/platform/windows/win_iocp.c index d0a39142..df0357c8 100644 --- a/src/platform/windows/win_iocp.c +++ b/src/platform/windows/win_iocp.c @@ -1,5 +1,6 @@ // // Copyright 2017 Garrett D'Amore <garrett@damore.org> +// Copyright 2017 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -213,12 +214,12 @@ nni_win_event_fini(nni_win_event *evt) // Use provider specific cancellation. evt->ops.wev_cancel(evt); - - // Wait for everything to stop referencing this. - while (evt->flags & NNI_WIN_EVENT_RUNNING) { - nni_cv_wait(&evt->cv); - } } + // Wait for everything to stop referencing this. + while (evt->flags & NNI_WIN_EVENT_RUNNING) { + nni_cv_wait(&evt->cv); + } + nni_mtx_unlock(&evt->mtx); } diff --git a/src/platform/windows/win_ipc.c b/src/platform/windows/win_ipc.c index 1a672c70..85e3dfca 100644 --- a/src/platform/windows/win_ipc.c +++ b/src/platform/windows/win_ipc.c @@ -1,5 +1,6 @@ // // Copyright 2017 Garrett D'Amore <garrett@damore.org> +// Copyright 2017 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -333,7 +334,10 @@ nni_win_ipc_acc_finish(nni_win_event *evt, nni_aio *aio) } aio->a_pipe = pipe; - nni_aio_finish(aio, 0, 0); + // What if the pipe is already finished? + if (nni_aio_finish(aio, 0, 0) != 0) { + nni_plat_ipc_pipe_fini(pipe); + } } static void @@ -559,8 +563,8 @@ nni_plat_ipc_ep_close(nni_plat_ipc_ep *ep) break; case NNI_EP_MODE_LISTEN: + nni_win_event_close(&ep->acc_ev); if (ep->p != INVALID_HANDLE_VALUE) { - nni_win_event_close(&ep->acc_ev); CloseHandle(ep->p); ep->p = INVALID_HANDLE_VALUE; } diff --git a/src/platform/windows/win_net.c b/src/platform/windows/win_net.c index d9abc670..59fc0986 100644 --- a/src/platform/windows/win_net.c +++ b/src/platform/windows/win_net.c @@ -1,5 +1,6 @@ // // Copyright 2017 Garrett D'Amore <garrett@damore.org> +// Copyright 2017 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -544,7 +545,9 @@ nni_win_tcp_acc_finish(nni_win_event *evt, nni_aio *aio) } aio->a_pipe = pipe; - nni_aio_finish(aio, 0, 0); + if (nni_aio_finish(aio, 0, 0) != 0) { + nni_plat_tcp_pipe_fini(pipe); + } } static int |
