[MINOR] ev_sepoll: refine flags management.
Ensure that we don't call the event handlers if the FD is already
marked FD_STERROR, and ensure that we properly catch HUP and ERR.
diff --git a/src/ev_sepoll.c b/src/ev_sepoll.c
index 24a343e..74917ad 100644
--- a/src/ev_sepoll.c
+++ b/src/ev_sepoll.c
@@ -295,7 +295,7 @@
fdtab[fd].ev = 0;
if ((fd_list[fd].e & FD_EV_MASK_R) == FD_EV_SPEC_R) {
- if (fdtab[fd].state != FD_STCLOSE) {
+ if (fdtab[fd].state != FD_STCLOSE && fdtab[fd].state != FD_STERROR) {
fdtab[fd].ev |= FD_POLL_IN;
if (fdtab[fd].cb[DIR_RD].f(fd) == 0)
status |= EPOLLIN;
@@ -303,7 +303,7 @@
}
if ((fd_list[fd].e & FD_EV_MASK_W) == FD_EV_SPEC_W) {
- if (fdtab[fd].state != FD_STCLOSE) {
+ if (fdtab[fd].state != FD_STCLOSE && fdtab[fd].state != FD_STERROR) {
fdtab[fd].ev |= FD_POLL_OUT;
if (fdtab[fd].cb[DIR_WR].f(fd) == 0)
status |= EPOLLOUT;
@@ -383,16 +383,16 @@
((e & EPOLLHUP) ? FD_POLL_HUP : 0);
if ((fd_list[fd].e & FD_EV_MASK_R) == FD_EV_WAIT_R) {
- if (fdtab[fd].state == FD_STCLOSE)
+ if (fdtab[fd].state == FD_STCLOSE || fdtab[fd].state == FD_STERROR)
continue;
- if (fdtab[fd].ev & FD_POLL_RD)
+ if (fdtab[fd].ev & (FD_POLL_RD|FD_POLL_HUP|FD_POLL_ERR))
fdtab[fd].cb[DIR_RD].f(fd);
}
if ((fd_list[fd].e & FD_EV_MASK_W) == FD_EV_WAIT_W) {
- if (fdtab[fd].state == FD_STCLOSE)
+ if (fdtab[fd].state == FD_STCLOSE || fdtab[fd].state == FD_STERROR)
continue;
- if (fdtab[fd].ev & FD_POLL_WR)
+ if (fdtab[fd].ev & (FD_POLL_WR|FD_POLL_ERR))
fdtab[fd].cb[DIR_WR].f(fd);
}
}