You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/25 17:46:32 UTC

[GitHub] [incubator-nuttx] GUIDINGLI opened a new pull request #5848: local_socket: default set block mode if accept() a new socket

GUIDINGLI opened a new pull request #5848:
URL: https://github.com/apache/incubator-nuttx/pull/5848


   ## Summary
   
       local_socket: default set block mode if accept() a new socket
       
       reference:
       https: //man7.org/linux/man-pages/man2/accept.2.html
       
       1. default set block mode if accept() a new socket
       2. local_socket support FIONBIO
       
   
   
   ## Impact
   
   local socket
   
   ## Testing
   
   VELA
   
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5848: local_socket: default set block mode if accept() a new socket

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5848:
URL: https://github.com/apache/incubator-nuttx/pull/5848#discussion_r835792487



##########
File path: net/local/local_sockif.c
##########
@@ -718,6 +718,17 @@ static int local_ioctl(FAR struct socket *psock, int cmd,
 
   switch (cmd)
     {
+      case FIONBIO:
+        if (conn->lc_infile.f_inode != NULL)
+          {
+            ret = file_ioctl(&conn->lc_infile, cmd, arg);
+          }
+
+        if (conn->lc_outfile.f_inode != NULL)
+          {
+            ret = file_ioctl(&conn->lc_outfile, cmd, arg);
+          }

Review comment:
       ```suggestion
           if (conn->lc_infile.f_inode != NULL)
             {
               ret = file_ioctl(&conn->lc_infile, cmd, arg);
             }
           else if (conn->lc_outfile.f_inode != NULL)
             {
               ret = file_ioctl(&conn->lc_outfile, cmd, arg);
             }
           else
             {
               ret = -ENOTCONN;
             }
   ```
   I'm not sure if that is correct, but returning `OK` if both `conn->lc_infile.f_inode` and `conn->lc_outfile.f_inode` are NULL seems not correct to me.




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] GUIDINGLI commented on a change in pull request #5848: local_socket: default set block mode if accept() a new socket

Posted by GitBox <gi...@apache.org>.
GUIDINGLI commented on a change in pull request #5848:
URL: https://github.com/apache/incubator-nuttx/pull/5848#discussion_r836270411



##########
File path: net/local/local_sockif.c
##########
@@ -718,6 +718,17 @@ static int local_ioctl(FAR struct socket *psock, int cmd,
 
   switch (cmd)
     {
+      case FIONBIO:
+        if (conn->lc_infile.f_inode != NULL)
+          {
+            ret = file_ioctl(&conn->lc_infile, cmd, arg);
+          }
+
+        if (conn->lc_outfile.f_inode != NULL)
+          {
+            ret = file_ioctl(&conn->lc_outfile, cmd, arg);
+          }

Review comment:
       That's not right if write like that.
   
   The local socket has two pipe connections, both of the need to be set.
   
   I did some small change, please see the new version.




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5848: local_socket: default set block mode if accept() a new socket

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5848:
URL: https://github.com/apache/incubator-nuttx/pull/5848


   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5848: local_socket: default set block mode if accept() a new socket

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5848:
URL: https://github.com/apache/incubator-nuttx/pull/5848#discussion_r836275403



##########
File path: net/local/local_sockif.c
##########
@@ -718,6 +718,17 @@ static int local_ioctl(FAR struct socket *psock, int cmd,
 
   switch (cmd)
     {
+      case FIONBIO:
+        if (conn->lc_infile.f_inode != NULL)
+          {
+            ret = file_ioctl(&conn->lc_infile, cmd, arg);
+          }
+
+        if (conn->lc_outfile.f_inode != NULL)
+          {
+            ret = file_ioctl(&conn->lc_outfile, cmd, arg);
+          }

Review comment:
       Now it is much better. Thank you. By sample code I just wanted to highlight that overwriting of a failed `ret` is wrong and returning `OK` when both pipes are NULL is wrong as well.




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org