mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-03 08:17:59 +00:00
MINOR: poll: more accurately compute the new maxfd in the loop
Last commit 173d995
("MEDIUM: polling: start to move maxfd computation
to the pollers") moved the maxfd computation to the polling loop, but
it still adds an entry when removing an fd, forcing the next loop to
seek from further away than necessary. Let's only update the max when
actually adding an entry.
This commit is contained in:
parent
f2b5c99b4c
commit
2d3c2db868
@ -96,17 +96,21 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
|
||||
HA_SPIN_LOCK(POLL_LOCK, &poll_lock);
|
||||
if ((eo & ~en) & FD_EV_POLLED_R)
|
||||
hap_fd_clr(fd, fd_evts[DIR_RD]);
|
||||
else if ((en & ~eo) & FD_EV_POLLED_R)
|
||||
else if ((en & ~eo) & FD_EV_POLLED_R) {
|
||||
hap_fd_set(fd, fd_evts[DIR_RD]);
|
||||
if (fd > max_add_fd)
|
||||
max_add_fd = fd;
|
||||
}
|
||||
|
||||
if ((eo & ~en) & FD_EV_POLLED_W)
|
||||
hap_fd_clr(fd, fd_evts[DIR_WR]);
|
||||
else if ((en & ~eo) & FD_EV_POLLED_W)
|
||||
else if ((en & ~eo) & FD_EV_POLLED_W) {
|
||||
hap_fd_set(fd, fd_evts[DIR_WR]);
|
||||
HA_SPIN_UNLOCK(POLL_LOCK, &poll_lock);
|
||||
if (fd > max_add_fd)
|
||||
max_add_fd = fd;
|
||||
}
|
||||
|
||||
if (fd > max_add_fd)
|
||||
max_add_fd = fd;
|
||||
HA_SPIN_UNLOCK(POLL_LOCK, &poll_lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user