BUG/MEDIUM: pollers/kqueue: use incremented position in event list

When composing the event list for subscribe to kqueue events, the index
where the new event is added must be after the previous events, as such
the changes counter should continue counting.

This caused haproxy to accept connections but not try read and process
the incoming data.

This patch is for 1.9 only
This commit is contained in:
PiBa-NL 2018-05-10 01:01:28 +02:00 committed by Willy Tarreau
parent 29d698040d
commit c55b88ece6

View File

@ -33,10 +33,10 @@ static int kqueue_fd[MAX_THREADS]; // per-thread kqueue_fd
static THREAD_LOCAL struct kevent *kev = NULL; static THREAD_LOCAL struct kevent *kev = NULL;
static struct kevent *kev_out = NULL; // Trash buffer for kevent() to write the eventlist in static struct kevent *kev_out = NULL; // Trash buffer for kevent() to write the eventlist in
static int _update_fd(int fd) static int _update_fd(int fd, int start)
{ {
int en; int en;
int changes = 0; int changes = start;
en = fdtab[fd].state; en = fdtab[fd].state;
@ -91,7 +91,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
activity[tid].poll_drop++; activity[tid].poll_drop++;
continue; continue;
} }
changes += _update_fd(fd); changes = _update_fd(fd, changes);
} }
/* Scan the global update list */ /* Scan the global update list */
for (old_fd = fd = update_list.first; fd != -1; fd = fdtab[fd].update.next) { for (old_fd = fd = update_list.first; fd != -1; fd = fdtab[fd].update.next) {
@ -109,7 +109,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
continue; continue;
if (!fdtab[fd].owner) if (!fdtab[fd].owner)
continue; continue;
changes += _update_fd(fd); changes = _update_fd(fd, changes);
} }
if (changes) { if (changes) {