dlizewski commented on code in PR #11107:
URL: https://github.com/apache/nuttx/pull/11107#discussion_r1377994323


##########
net/socket/socket.c:
##########
@@ -104,9 +104,11 @@ int psock_socket(int domain, int type, int protocol,
 
   /* When usrsock daemon returns -ENOSYS or -ENOTSUP, it means to use
    * kernel's network stack, so fallback to kernel socket.
+   * When -ENETDOWN is returned, it means the usrsock daemon was never
+   * launched or is no longer running, so fallback to kernel socket.
    */
 
-  if (ret == 0 || (ret != -ENOSYS && ret != -ENOTSUP))
+  if (ret == 0 || (ret != -ENOSYS && ret != -ENOTSUP && ret != -ENETDOWN))

Review Comment:
   As far as I can see, -ENETDOWN is only returned from usrsock_sockif_setup() 
if either:
   a. the application side doesn't have the dev node open. In which case 
usrsockdev_is_opened() returns false in usrsock_request().
     
usrsock_sockif_setup()->usrsock_socket()->do_socket_request()->usrsock_do_request()->usrsock_request
 returns() -> returns -ENETDOWN
   
   b. The USRSOCK_EVENT_ABORT event is sent to the callback "socket_event" 
registered in usrsock_socket().
   The USRSOCK_EVENT_ABORT is only set in usrsock_abort() which is called when 
the application closes the /dev/usrsock devnode. Both cases should fallback to 
kernel provided sockets.
   
   
   Is there another case of -ENETDOWN that I did not see?



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to