This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 1cdcc10f3624041e4594e96e01757c58b9a069cf Author: Marco Casaroli <[email protected]> AuthorDate: Wed Nov 25 19:23:21 2026 +0100 net/tcp: Keep the poll callback of an epoll set after an event. tcp_poll_eventhandler() stopped its callback after the first notification that set an event, because poll() is woken once and then tears its poll down. An epoll set does not tear down the poll of an EPOLLET file after an event (epoll_teardown() in fs/vfs/fs_epoll.c): it waits for the next notification. So a TCP socket in such a set got its first event and then no other. For example, new data on a kept-alive connection was never reported. Keep the callback of an epoll set (POLLALWAYS) active until the poll teardown. poll() and select() do not change. The poll callbacks of UDP and packet sockets stay active until the teardown already. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- net/tcp/tcp_netpoll.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c index aa4c19fdc5d..e142045bd1b 100644 --- a/net/tcp/tcp_netpoll.c +++ b/net/tcp/tcp_netpoll.c @@ -189,10 +189,13 @@ static uint32_t tcp_poll_eventhandler(FAR struct net_driver_s *dev, poll_notify(&info->fds, 1, eventset); - if (info->fds->revents != 0) - { - /* Stop further callbacks */ + /* poll() is woken up once: stop further callbacks. An epoll set + * (POLLALWAYS) keeps the poll set up across its waits (EPOLLET): + * it needs the next events too. + */ + if (info->fds->revents != 0 && (info->fds->events & POLLALWAYS) == 0) + { info->cb->flags = 0; info->cb->priv = NULL; info->cb->event = NULL;
