]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: poll/epoll: move detection of RDHUP support earlier
authorWilly Tarreau <w@1wt.eu>
Thu, 29 Jul 2021 14:19:24 +0000 (16:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 30 Jul 2021 15:41:55 +0000 (17:41 +0200)
Let's move the detection of support for RDHUP earlier and out of the
FD update chain, as it complicates its simplification.

src/ev_epoll.c
src/ev_poll.c

index 330c38c4495f1f3559a50bf8a52812220e26b921..8810b77857491ec54ea37330e35aa748179a47f1 100644 (file)
@@ -222,6 +222,9 @@ static void _do_poll(struct poller *p, int exp, int wake)
                e = epoll_events[count].events;
                fd = epoll_events[count].data.fd;
 
+               if ((e & EPOLLRDHUP) && !(cur_poller.flags & HAP_POLL_F_RDHUP))
+                       _HA_ATOMIC_OR(&cur_poller.flags, HAP_POLL_F_RDHUP);
+
 #ifdef DEBUG_FD
                _HA_ATOMIC_INC(&fdtab[fd].event_count);
 #endif
@@ -245,9 +248,6 @@ static void _do_poll(struct poller *p, int exp, int wake)
                    ((e & EPOLLHUP)   ? FD_EV_SHUT_RW : 0) |
                    ((e & EPOLLERR)   ? FD_EV_ERR_RW  : 0);
 
-               if ((e & EPOLLRDHUP) && !(cur_poller.flags & HAP_POLL_F_RDHUP))
-                       _HA_ATOMIC_OR(&cur_poller.flags, HAP_POLL_F_RDHUP);
-
                fd_update_events(fd, n);
        }
        /* the caller will take care of cached events */
index c30aadbe1aeb2e282068d374c3154f158a199fa0..6bd0cf47317c19548d4e6e82bfa29762837ff20e 100644 (file)
@@ -218,6 +218,9 @@ static void _do_poll(struct poller *p, int exp, int wake)
                int e = poll_events[count].revents;
                fd = poll_events[count].fd;
 
+               if ((e & POLLRDHUP) && !(cur_poller.flags & HAP_POLL_F_RDHUP))
+                       _HA_ATOMIC_OR(&cur_poller.flags, HAP_POLL_F_RDHUP);
+
 #ifdef DEBUG_FD
                _HA_ATOMIC_INC(&fdtab[fd].event_count);
 #endif
@@ -245,9 +248,6 @@ static void _do_poll(struct poller *p, int exp, int wake)
                    ((e & POLLHUP)   ? FD_EV_SHUT_RW : 0) |
                    ((e & POLLERR)   ? FD_EV_ERR_RW  : 0);
 
-               if ((e & POLLRDHUP) && !(cur_poller.flags & HAP_POLL_F_RDHUP))
-                       _HA_ATOMIC_OR(&cur_poller.flags, HAP_POLL_F_RDHUP);
-
                fd_update_events(fd, n);
        }