mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-15 07:54:33 +00:00
[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.
This commit is contained in:
parent
6996e15e16
commit
8bb46f4015
@ -295,7 +295,7 @@ REGPRM2 static void _do_poll(struct poller *p, int wait_time)
|
|||||||
fdtab[fd].ev = 0;
|
fdtab[fd].ev = 0;
|
||||||
|
|
||||||
if ((fd_list[fd].e & FD_EV_MASK_R) == FD_EV_SPEC_R) {
|
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;
|
fdtab[fd].ev |= FD_POLL_IN;
|
||||||
if (fdtab[fd].cb[DIR_RD].f(fd) == 0)
|
if (fdtab[fd].cb[DIR_RD].f(fd) == 0)
|
||||||
status |= EPOLLIN;
|
status |= EPOLLIN;
|
||||||
@ -303,7 +303,7 @@ REGPRM2 static void _do_poll(struct poller *p, int wait_time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((fd_list[fd].e & FD_EV_MASK_W) == FD_EV_SPEC_W) {
|
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;
|
fdtab[fd].ev |= FD_POLL_OUT;
|
||||||
if (fdtab[fd].cb[DIR_WR].f(fd) == 0)
|
if (fdtab[fd].cb[DIR_WR].f(fd) == 0)
|
||||||
status |= EPOLLOUT;
|
status |= EPOLLOUT;
|
||||||
@ -383,16 +383,16 @@ REGPRM2 static void _do_poll(struct poller *p, int wait_time)
|
|||||||
((e & EPOLLHUP) ? FD_POLL_HUP : 0);
|
((e & EPOLLHUP) ? FD_POLL_HUP : 0);
|
||||||
|
|
||||||
if ((fd_list[fd].e & FD_EV_MASK_R) == FD_EV_WAIT_R) {
|
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;
|
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);
|
fdtab[fd].cb[DIR_RD].f(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fd_list[fd].e & FD_EV_MASK_W) == FD_EV_WAIT_W) {
|
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;
|
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);
|
fdtab[fd].cb[DIR_WR].f(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user