epoll: Tiny cleanup to udp_sock_handler()

Move the test for c->no_udp into the function itself, rather than in the
dispatching switch statement to better localize the UDP specific logic, and
make for greated consistency with other handler functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-08-11 15:12:25 +10:00 committed by Stefano Brivio
parent 05f606ab0b
commit 8271a2ed57
2 changed files with 2 additions and 3 deletions

View file

@ -325,8 +325,7 @@ loop:
tcp_sock_handler(&c, ref, eventmask, &now); tcp_sock_handler(&c, ref, eventmask, &now);
break; break;
case EPOLL_TYPE_UDP: case EPOLL_TYPE_UDP:
if (!c.no_udp) udp_sock_handler(&c, ref, eventmask, &now);
udp_sock_handler(&c, ref, eventmask, &now);
break; break;
case EPOLL_TYPE_ICMP: case EPOLL_TYPE_ICMP:
icmp_sock_handler(&c, ref); icmp_sock_handler(&c, ref);

2
udp.c
View file

@ -756,7 +756,7 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
struct mmsghdr *mmh_recv; struct mmsghdr *mmh_recv;
int i, m; int i, m;
if (!(events & EPOLLIN)) if (c->no_udp || !(events & EPOLLIN))
return; return;
if (v6) { if (v6) {