aboutsummaryrefslogtreecommitdiff
path: root/src/core/endpt.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-07-18 11:00:08 -0700
committerGarrett D'Amore <garrett@damore.org>2017-07-18 11:00:08 -0700
commitab7772be3e3c208a48408b67924d3b58fca7f474 (patch)
treeb7355183556350de73303c6e75a5d278528dda0e /src/core/endpt.c
parentc41129ca0efacf13fe1363ed12f9723274c521e7 (diff)
downloadnng-ab7772be3e3c208a48408b67924d3b58fca7f474.tar.gz
nng-ab7772be3e3c208a48408b67924d3b58fca7f474.tar.bz2
nng-ab7772be3e3c208a48408b67924d3b58fca7f474.zip
Fix close-related leak of pipes.
We have seen leaks of pipes causing test failures (e.g. the Windows IPC test) due to EADDRINUSE. This was caused by a case where we failed to pass the pipe up because the AIO had already been canceled, and we didn't realize that we had oprhaned the pipe. The fix is to add a return value to nni_aio_finish, and verify that we did finish properly, or if we did not then we must free the pipe ourself. (The zero return from nni_aio_finish indicates that it accepts ownership of resources passed via the aio.)
Diffstat (limited to 'src/core/endpt.c')
-rw-r--r--src/core/endpt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c
index 4ed678d7..8048de2b 100644
--- a/src/core/endpt.c
+++ b/src/core/endpt.c
@@ -397,7 +397,7 @@ nni_ep_accept_start(nni_ep *ep)
if (ep->ep_closed) {
return;
}
-
+ aio->a_pipe = NULL;
aio->a_endpt = ep->ep_data;
ep->ep_ops.ep_accept(ep->ep_data, aio);
}