1
0
Fork 0
forked from nuttx/nuttx-update

local: add net_lock to local_listen

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-11-15 11:34:53 +08:00 committed by Xiang Xiao
parent c38d6f1ae4
commit 139663ba89

View file

@ -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;
}