From 57c4342e4f666f694a06723e7c32f7105b0ca525 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 23 Feb 2015 18:33:50 -0500 Subject: [PATCH] aix: always deregister closing fds from epoll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In debugging test-tls-ocsp-callback.js for the 0.12.0 Node on AIX we discovered that there was code missing in uv__platform_invalidate_fd() in aix.c which removes the file descriptor from the pollset when needed. We based the impelementation in aix.c on the unix version in linux-core.cc. We can see that this issue was addressed for linux in commit 780d8ad. PR-URL: https://github.com/libuv/libuv/pull/221 Reviewed-By: Saúl Ibarra Corretgé --- src/unix/aix.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/unix/aix.c b/src/unix/aix.c index ec800c7a..0d904961 100644 --- a/src/unix/aix.c +++ b/src/unix/aix.c @@ -1218,16 +1218,23 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { struct pollfd* events; uintptr_t i; uintptr_t nfds; + struct poll_ctl pc; assert(loop->watchers != NULL); events = (struct pollfd*) loop->watchers[loop->nwatchers]; nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1]; - if (events == NULL) - return; - /* Invalidate events with same file descriptor */ - for (i = 0; i < nfds; i++) - if ((int) events[i].fd == fd) - events[i].fd = -1; + if (events != NULL) + /* Invalidate events with same file descriptor */ + for (i = 0; i < nfds; i++) + if ((int) events[i].fd == fd) + events[i].fd = -1; + + /* Remove the file descriptor from the poll set */ + pc.events = 0; + pc.cmd = PS_DELETE; + pc.fd = fd; + if(loop->backend_fd >= 0) + pollset_ctl(loop->backend_fd, &pc, 1); }