forked from nuttx/nuttx-update
local: add net_lock to local_listen
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
c38d6f1ae4
commit
139663ba89
1 changed files with 5 additions and 0 deletions
|
@ -79,6 +79,8 @@ int local_listen(FAR struct socket *psock, int backlog)
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
net_lock();
|
||||
|
||||
server = (FAR struct local_conn_s *)psock->s_conn;
|
||||
|
||||
/* Some sanity checks */
|
||||
|
@ -87,6 +89,7 @@ int local_listen(FAR struct socket *psock, int backlog)
|
|||
server->lc_state == LOCAL_STATE_UNBOUND ||
|
||||
server->lc_type != LOCAL_TYPE_PATHNAME)
|
||||
{
|
||||
net_unlock();
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
|
@ -117,6 +120,8 @@ int local_listen(FAR struct socket *psock, int backlog)
|
|||
server->lc_state = LOCAL_STATE_LISTENING;
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue