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_select.c b/src/ev_select.c
index a878340..87ca348 100644
--- a/src/ev_select.c
+++ b/src/ev_select.c
@@ -161,18 +161,7 @@
if (FD_ISSET(fd, tmp_evts[DIR_WR]))
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);
}
}
}