net/: icmp[v6]_pollsetup should always return POLLWRNORM if the caller requests it since ICMP[v6] doesn't utilize IOB buffer for sending and always needs to wait for an ICMP[v6]_POLL.

This commit is contained in:
Xiang Xiao 2019-11-27 08:04:14 -06:00 committed by Gregory Nutt
parent ea666877f2
commit 250bde034d
2 changed files with 12 additions and 24 deletions

View File

@ -137,13 +137,6 @@ 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)
@ -221,11 +214,6 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
cb->priv = (FAR void *)info;
cb->event = icmp_poll_eventhandler;
if ((fds->events & POLLOUT) != 0)
{
cb->flags |= ICMP_POLL;
}
if ((fds->events & POLLIN) != 0)
{
cb->flags |= ICMP_NEWDATA;
@ -246,6 +234,12 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
fds->revents |= (POLLRDNORM & fds->events);
}
/* Always report POLLWRNORM if caller request it because we don't utilize
* IOB buffer for sending.
*/
fds->revents |= (POLLWRNORM & fds->events);
/* Check if any requested events are already in effect */
if (fds->revents != 0)

View File

@ -137,13 +137,6 @@ 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)
@ -219,11 +212,6 @@ int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
cb->priv = (FAR void *)info;
cb->event = icmpv6_poll_eventhandler;
if ((fds->events & POLLOUT) != 0)
{
cb->flags |= ICMPv6_POLL;
}
if ((fds->events & POLLIN) != 0)
{
cb->flags |= ICMPv6_NEWDATA;
@ -244,6 +232,12 @@ int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
fds->revents |= (POLLRDNORM & fds->events);
}
/* Always report POLLWRNORM if caller request it because we don't utilize
* IOB buffer for sending.
*/
fds->revents |= (POLLWRNORM & fds->events);
/* Check if any requested events are already in effect */
if (fds->revents != 0)