aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_pollq_poll.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-02-21 11:08:23 -0800
committerGarrett D'Amore <garrett@damore.org>2018-02-21 11:08:23 -0800
commita4d378030df61760ea4daa2ddbe46b1366f8e977 (patch)
tree7bd8bc37acb1aea849eee2daab429e36676fd59e /src/platform/posix/posix_pollq_poll.c
parent5fe9202ffedf3a57ec789d622bc52efc3435628b (diff)
downloadnng-a4d378030df61760ea4daa2ddbe46b1366f8e977.tar.gz
nng-a4d378030df61760ea4daa2ddbe46b1366f8e977.tar.bz2
nng-a4d378030df61760ea4daa2ddbe46b1366f8e977.zip
Fixes for POSIX pollq structure.
It was possible for pollq arm to be called on a node that was removed in some circumstances -- particularly and ep that was closed in the callback. While here, lets use normal booleans for closed state, and only call the arm function (which is not free -- typicall it involves a mutex and may even involve a system call) if we are going to arm some events. We also initialize these things properly, and clean up a stale comment. This work is done to faciliate the kqueue work by @liamstask.
Diffstat (limited to 'src/platform/posix/posix_pollq_poll.c')
-rw-r--r--src/platform/posix/posix_pollq_poll.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/platform/posix/posix_pollq_poll.c b/src/platform/posix/posix_pollq_poll.c
index 8b386ecd..8e3bc741 100644
--- a/src/platform/posix/posix_pollq_poll.c
+++ b/src/platform/posix/posix_pollq_poll.c
@@ -283,9 +283,7 @@ nni_posix_pollq_arm(nni_posix_pollq_node *node, int events)
nni_posix_pollq *pq = node->pq;
int oevents;
- if (pq == NULL) {
- return;
- }
+ NNI_ASSERT(pq != NULL);
nni_mtx_lock(&pq->mtx);
oevents = node->events;