diff --git a/net/icmp/icmp_netpoll.c b/net/icmp/icmp_netpoll.c index 05d5085464..f168d8e441 100644 --- a/net/icmp/icmp_netpoll.c +++ b/net/icmp/icmp_netpoll.c @@ -130,13 +130,6 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLIN & info->fds->events); } - /* ICMP_POLL is a sign that we are free to send data. */ - - if ((flags & DEVPOLL_MASK) == ICMP_POLL) - { - eventset |= (POLLOUT & info->fds->events); - } - /* Check for loss of connection events. */ if ((flags & NETDEV_DOWN) != 0) @@ -144,6 +137,13 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLHUP | POLLERR); } + /* ICMP_POLL is a sign that we are free to send data. */ + + else if ((flags & DEVPOLL_MASK) == ICMP_POLL) + { + eventset |= (POLLOUT & info->fds->events); + } + /* Awaken the caller of poll() is requested event occurred. */ if (eventset) diff --git a/net/icmpv6/icmpv6_netpoll.c b/net/icmpv6/icmpv6_netpoll.c index a7c5371b39..433f743add 100644 --- a/net/icmpv6/icmpv6_netpoll.c +++ b/net/icmpv6/icmpv6_netpoll.c @@ -130,13 +130,6 @@ static uint16_t icmpv6_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLIN & info->fds->events); } - /* ICMP_POLL is a sign that we are free to send data. */ - - if ((flags & DEVPOLL_MASK) == ICMPv6_POLL) - { - eventset |= (POLLOUT & info->fds->events); - } - /* Check for loss of connection events. */ if ((flags & NETDEV_DOWN) != 0) @@ -144,6 +137,13 @@ static uint16_t icmpv6_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLHUP | POLLERR); } + /* ICMP_POLL is a sign that we are free to send data. */ + + else if ((flags & DEVPOLL_MASK) == ICMPv6_POLL) + { + eventset |= (POLLOUT & info->fds->events); + } + /* Awaken the caller of poll() is requested event occurred. */ if (eventset) diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c index f2c6f3b1ba..eea06ee641 100644 --- a/net/tcp/tcp_netpoll.c +++ b/net/tcp/tcp_netpoll.c @@ -120,13 +120,6 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= POLLIN & info->fds->events; } - /* A poll is a sign that we are free to send data. */ - - if ((flags & TCP_POLL) != 0 && psock_tcp_cansend(info->psock) >= 0) - { - eventset |= (POLLOUT & info->fds->events); - } - /* Check for a loss of connection events. */ if ((flags & TCP_DISCONN_EVENTS) != 0) @@ -137,6 +130,13 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLERR | POLLHUP); } + /* A poll is a sign that we are free to send data. */ + + else if ((flags & TCP_POLL) != 0 && psock_tcp_cansend(info->psock) >= 0) + { + eventset |= (POLLOUT & info->fds->events); + } + /* Awaken the caller of poll() if requested event occurred. */ if (eventset != 0) diff --git a/net/udp/udp_netpoll.c b/net/udp/udp_netpoll.c index 9c2ae9a134..b6fcc85403 100644 --- a/net/udp/udp_netpoll.c +++ b/net/udp/udp_netpoll.c @@ -120,13 +120,6 @@ static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLIN & info->fds->events); } - /* A poll is a sign that we are free to send data. */ - - if ((flags & UDP_POLL) != 0 && psock_udp_cansend(info->psock) >= 0) - { - eventset |= (POLLOUT & info->fds->events); - } - /* Check for loss of connection events. */ if ((flags & NETDEV_DOWN) != 0) @@ -134,6 +127,13 @@ static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev, eventset |= (POLLHUP | POLLERR); } + /* A poll is a sign that we are free to send data. */ + + else if ((flags & UDP_POLL) != 0 && psock_udp_cansend(info->psock) >= 0) + { + eventset |= (POLLOUT & info->fds->events); + } + /* Awaken the caller of poll() is requested event occurred. */ if (eventset)