Skip to content

Commit 3d0a49f

Browse files
anchaoxiaoxiang781216
authored andcommitted
examples/usrsocktest: read from the closed remote should return EOF
fix usrsock remote_disconnect fail: nsh> usrsocktest ... Testing group "remote_disconnect" => [TEST ASSERT FAILED!] In function "receive": line 497: Assertion `(ssize_t)((ret)) == (ssize_t)((0))' failed. got value: -1 should be: 0 Group "remote_disconnect": [FAILED] ... Reference: RECV(2) NAME recv, recvfrom, recvmsg - receive a message from a socket ... RETURN VALUE ... When a stream socket peer has performed an orderly shutdown, the return value will be 0 (the traditional "end-of-file" return). Datagram sockets in various domains (e.g., the UNIX and Internet domains) permit zero-length datagrams. When such a datagram is received, the return value is 0. Signed-off-by: chao an <[email protected]>
1 parent 6bc5196 commit 3d0a49f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/usrsocktest/usrsocktest_daemon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ static int recvfrom_request(int fd, FAR struct daemon_priv_s *priv,
856856

857857
if (!tsock->connected)
858858
{
859-
ret = -ENOTCONN;
859+
ret = (tsock->endp) ? 0 : -ENOTCONN;
860860
goto prepare;
861861
}
862862

0 commit comments

Comments
 (0)