From 2729907d4b618e1b35b4b0d1b4f6271f5139ebef Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 26 Feb 2018 16:27:01 -0800 Subject: Hang in concurrent IPC connection close. ConnectNamedPipe can return ERROR_PIPE_CONNECTED, and does not enqueue a completion packet if it does. So we need to handle that specially. --- src/platform/windows/win_ipc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/platform/windows/win_ipc.c b/src/platform/windows/win_ipc.c index f967a054..8c94e404 100644 --- a/src/platform/windows/win_ipc.c +++ b/src/platform/windows/win_ipc.c @@ -336,10 +336,11 @@ nni_win_ipc_acc_start(nni_win_event *evt, nni_aio *aio) int rv = GetLastError(); switch (rv) { case ERROR_PIPE_CONNECTED: - // Synch completion already occurred. - // Windows is weird. Apparently the I/O - // completion packet has already been sent. - return (0); + // Kind of like success, but as this is technically + // an "error", we have to complete it ourself. + evt->status = 0; + evt->count = 0; + return (1); case ERROR_IO_PENDING: // Normal asynchronous operation. Wait for @@ -354,8 +355,8 @@ nni_win_ipc_acc_start(nni_win_event *evt, nni_aio *aio) } } - // Synch completion right now. I/O completion packet delivered - // already. + // Synchronous success - the I/O completion packet should still + // be delivered. return (0); } -- cgit v1.2.3-70-g09d2