LingaoM commented on code in PR #19456:
URL: https://github.com/apache/nuttx/pull/19456#discussion_r3620149170


##########
arch/sim/src/sim/posix/sim_hostusrsock.c:
##########
@@ -327,20 +429,37 @@ int host_usrsock_connect(int sockfd,
                          const struct nuttx_sockaddr *addr,
                          nuttx_socklen_t addrlen)
 {
-  struct sockaddr naddr;
+  struct sockaddr_storage naddr;
   socklen_t naddrlen;
   int ret;
 
-  sockaddr_to_native(addr, addrlen, &naddr, &naddrlen);
+  ret = sockaddr_to_native(addr, addrlen, &naddr, &naddrlen);
+  if (ret < 0)
+    {
+      return ret;
+    }
 
-  sock_nonblock(sockfd, false);
-  ret = connect(sockfd, &naddr, naddrlen);
-  sock_nonblock(sockfd, true);
+  ret = connect(sockfd, (struct sockaddr *)&naddr, naddrlen);
   if (ret < 0)
     {
+      if (errno == EISCONN)
+        {
+          host_usrsock_clear_fd(sockfd, &g_active_write_fds);

Review Comment:
   Changed. We no longer handle `EISCONN` specially; connect completion is now 
reported through the normal writable-fd path in `host_usrsock_loop()`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to