net/: ICMP/ICMPv6/TCP/UDP poll shouldn't set POLLHUP and POLLOUT at the same time the standard require that only report POLLHUP:
https://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html.
This commit is contained in:
parent
34ec7c97eb
commit
1905e01fda
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue