]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: Don't forget to reset fdtab[fd].update when a fd is added/removed
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 1 Jun 2017 14:55:03 +0000 (16:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 Sep 2017 08:16:42 +0000 (10:16 +0200)
It used to be guaranteed by the polling functions on a later call but
with concurrent accesses it cannot be granted anymore.

include/proto/fd.h
src/fd.c

index 1efe32399aa6bcc65ff7fe28e4ce968f76efe783..38c12b687ea564ba41c62d3c993861aa0c0dab2a 100644 (file)
@@ -338,6 +338,7 @@ static inline void fd_insert(int fd)
 {
        fdtab[fd].ev = 0;
        fdtab[fd].new = 1;
+       fdtab[fd].updated = 0;
        fdtab[fd].linger_risk = 0;
        fdtab[fd].cloned = 0;
        if (fd + 1 > maxfd)
index 1a62f9a66905a9ddf34e2a1a9f10d167f501f7ab..c197557be1def8e2533168c8ed8a3ad16148db96 100644 (file)
--- a/src/fd.c
+++ b/src/fd.c
@@ -190,10 +190,11 @@ static void fd_dodelete(int fd, int do_close)
 
        port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);
        fdinfo[fd].port_range = NULL;
-       if (do_close)
-               close(fd);
        fdtab[fd].owner = NULL;
+       fdtab[fd].updated = 0;
        fdtab[fd].new = 0;
+       if (do_close)
+               close(fd);
 
        while ((maxfd-1 >= 0) && !fdtab[maxfd-1].owner)
                maxfd--;