michallenc commented on issue #16555: URL: https://github.com/apache/nuttx/issues/16555#issuecomment-2996528799
Standard send/receive can be fixed by this. ```diff diff --git a/net/local/local_recvmsg.c b/net/local/local_recvmsg.c index 7f44907650..05baeaba48 100644 --- a/net/local/local_recvmsg.c +++ b/net/local/local_recvmsg.c @@ -547,7 +547,7 @@ ssize_t local_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg, /* Check shutdown state */ - if (conn->lc_infile.f_inode == NULL) + if (psock->s_type != SOCK_DGRAM && conn->lc_infile.f_inode == NULL) { return 0; } diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c index b64bdf5b3b..8a43798709 100644 --- a/net/local/local_sendmsg.c +++ b/net/local/local_sendmsg.c @@ -439,7 +439,7 @@ ssize_t local_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg, /* Check shutdown state */ - if (conn->lc_outfile.f_inode == NULL) + if (psock->s_type != SOCK_DGRAM && conn->lc_outfile.f_inode == NULL) { return -EPIPE; } ``` The check for `conn->lc_infile.f_inode == NULL` is not required for DGRAM socket because `psock_dgram_recvfrom` creates half duplex FIFO itself if it doesn't exist (here https://github.com/apache/nuttx/blob/master/net/local/local_recvmsg.c#L390) and `local_sendto` used for datagrams (as there is no connection) creates it as well. The question is why the check is in a common code now. It seems just like an unnecessary duplication, because `psock_stream_recvfrom` and `local_send` already check if inode is not NULL. We can either add a condition as showed in the diff or revert PR https://github.com/apache/nuttx/pull/14103 as the check should not be needed. @GUIDINGLI Could you share some info what was the goal of the additional check? -- 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