mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
local: correct shutdown state when use UDP mode
Signed-off-by: ligd <liguiding1@xiaomi.com> Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
6d50274ebe
commit
7ccdd29f3e
2 changed files with 16 additions and 4 deletions
|
@ -237,13 +237,19 @@ psock_stream_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
|
|||
|
||||
/* Verify that this is a connected peer socket */
|
||||
|
||||
if (conn->lc_state != LOCAL_STATE_CONNECTED ||
|
||||
conn->lc_infile.f_inode == NULL)
|
||||
if (conn->lc_state != LOCAL_STATE_CONNECTED)
|
||||
{
|
||||
nerr("ERROR: not connected\n");
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
/* Check shutdown state */
|
||||
|
||||
if (conn->lc_infile.f_inode == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If it is non-blocking mode, the data in fifo is 0 and
|
||||
* returns directly
|
||||
*/
|
||||
|
|
|
@ -186,13 +186,19 @@ static ssize_t local_send(FAR struct socket *psock,
|
|||
* opened the outgoing FIFO for write-only access.
|
||||
*/
|
||||
|
||||
if (peer->lc_state != LOCAL_STATE_CONNECTED ||
|
||||
peer->lc_outfile.f_inode == NULL)
|
||||
if (peer->lc_state != LOCAL_STATE_CONNECTED)
|
||||
{
|
||||
nerr("ERROR: not connected\n");
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
/* Check shutdown state */
|
||||
|
||||
if (peer->lc_outfile.f_inode == NULL)
|
||||
{
|
||||
return -EPIPE;
|
||||
}
|
||||
|
||||
/* Send the packet */
|
||||
|
||||
ret = nxmutex_lock(&peer->lc_sendlock);
|
||||
|
|
Loading…
Reference in a new issue