This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0100e8338e net: Fix unreadable error when doing poll operation on tcp 
socket.
0100e8338e is described below

commit 0100e8338e5b35478ce4a808238f4bef949e3a76
Author: liqinhui <[email protected]>
AuthorDate: Fri Mar 24 16:30:27 2023 +0800

    net: Fix unreadable error when doing poll operation on tcp socket.
    
    When do poll operation and the tcp connection state is TCP_ALLOCATED, 
eventset(POLLERR|POLLHUP) is return, causing the libuv poll_multiple_handles to 
fail.
    
    Verification: Use the libuv test case ` uv_run_tests poll_multiple_handles`.
    Signed-off-by: liqinhui <[email protected]>
---
 net/tcp/tcp_netpoll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c
index 2f1ca92b56..796c0a8b0e 100644
--- a/net/tcp/tcp_netpoll.c
+++ b/net/tcp/tcp_netpoll.c
@@ -219,7 +219,8 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct 
pollfd *fds)
 
   /* Non-blocking connection ? */
 
-  nonblock_conn = (conn->tcpstateflags == TCP_SYN_SENT &&
+  nonblock_conn = ((conn->tcpstateflags == TCP_ALLOCATED ||
+                    conn->tcpstateflags == TCP_SYN_SENT) &&
                    _SS_ISNONBLOCK(conn->sconn.s_flags));
 
   /* Find a container to hold the poll information */

Reply via email to