MEDIUM: polling: centralize polled events processing
Currently, each poll loop handles the polled events the same way,
resulting in a lot of duplicated, complex code. Additionally, epoll
was the only one to handle newly created FDs immediately.
So instead, let's move that code to fd.c in a new function dedicated
to this task : fd_process_polled_events(). All pollers now use this
function.
diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c
index dab6f5b..0473adc 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -152,18 +152,7 @@
fdtab[fd].ev |= FD_POLL_OUT;
}
- if (fdtab[fd].iocb && fdtab[fd].ev) {
- if (fdtab[fd].ev & FD_POLL_IN)
- fd_may_recv(fd);
-
- if (fdtab[fd].ev & FD_POLL_OUT)
- fd_may_send(fd);
-
- if (fdtab[fd].cache)
- continue;
-
- fdtab[fd].iocb(fd);
- }
+ fd_process_polled_events(fd);
}
}