xiaoxiang781216 commented on code in PR #9647:
URL: https://github.com/apache/nuttx/pull/9647#discussion_r1272568842
##########
net/socket/socket.c:
##########
@@ -93,23 +94,50 @@ int psock_socket(int domain, int type, int protocol,
psock->s_conn = NULL;
psock->s_type = type & SOCK_TYPE_MASK;
- /* Get the socket interface */
+#ifdef CONFIG_NET_USRSOCK
+ /* Get the usrsock interface */
- sockif = net_sockif(domain, psock->s_type, psock->s_proto);
- if (sockif == NULL)
+ sockif = &g_usrsock_sockif;
+ psock->s_sockif = sockif;
+
+ ret = sockif->si_setup(psock);
+
+ /* When usrsock daemon returns -EPROTONOSUPPORT, it means to use
+ * kernel's network stack, so fallback to kernel socket.
+ */
+
+ if (ret == -ENOSYS || ret == -ENOSUP)
Review Comment:
```
if (ret != -ENOSYS || ret != -ENOSUP)
{
return ret;
}
```
and keep the rest code without change,
--
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]