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:
parent
05f606ab0b
commit
8271a2ed57
2 changed files with 2 additions and 3 deletions
1
passt.c
1
passt.c
|
@ -325,7 +325,6 @@ 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:
|
||||||
|
|
2
udp.c
2
udp.c
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue