usrsock_server: Do not poll SOCK_CTRL.

It seems that we don't need to poll the SOCK_CTRL sockets, so skip them in usrsock server.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2023-03-24 17:11:39 +08:00 committed by Alan Carvalho de Assis
parent 61ff04b9e2
commit 9fd4d6b767
1 changed files with 12 additions and 4 deletions

View File

@ -1027,8 +1027,16 @@ static void usrsock_rpmsg_poll_setup(FAR struct pollfd *pfds,
pollevent_t events)
{
FAR struct usrsock_rpmsg_s *priv = (FAR struct usrsock_rpmsg_s *)pfds->arg;
FAR struct socket *psock = &priv->socks[pfds->fd];
int ret = 0;
/* No poll for SOCK_CTRL. */
if (psock->s_type == SOCK_CTRL)
{
return;
}
net_lock();
if (events)
@ -1037,7 +1045,7 @@ static void usrsock_rpmsg_poll_setup(FAR struct pollfd *pfds,
{
pfds->revents = 0;
pfds->events = events;
ret = psock_poll(&priv->socks[pfds->fd], pfds, true);
ret = psock_poll(psock, pfds, true);
}
else
{
@ -1047,15 +1055,15 @@ static void usrsock_rpmsg_poll_setup(FAR struct pollfd *pfds,
else
{
pfds->events = 0;
ret = psock_poll(&priv->socks[pfds->fd], pfds, false);
ret = psock_poll(psock, pfds, false);
}
if (ret < 0)
{
nerr("psock_poll failed. ret %d domain %u type %u pfds->fd %d"
", pfds->events %08" PRIx32 ", pfds->revents %08" PRIx32,
ret, priv->socks[pfds->fd].s_domain, priv->socks[pfds->fd].s_type,
pfds->fd, pfds->events, pfds->revents);
ret, psock->s_domain, psock->s_type, pfds->fd,
pfds->events, pfds->revents);
}
net_unlock();