net/rpmsg: sendsize should be protected by sendlock not recvlock
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
5b372a4706
commit
034215ab9c
1 changed files with 5 additions and 5 deletions
|
@ -334,7 +334,7 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
|
|||
|
||||
if (head->cmd == RPMSG_SOCKET_CMD_SYNC)
|
||||
{
|
||||
nxmutex_lock(&conn->recvlock);
|
||||
nxmutex_lock(&conn->sendlock);
|
||||
conn->sendsize = head->size;
|
||||
conn->cred.pid = head->pid;
|
||||
conn->cred.uid = head->uid;
|
||||
|
@ -346,7 +346,7 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
|
|||
|
||||
rpmsg_socket_post(&conn->sendsem);
|
||||
rpmsg_socket_poll_notify(conn, POLLOUT);
|
||||
nxmutex_unlock(&conn->recvlock);
|
||||
nxmutex_unlock(&conn->sendlock);
|
||||
}
|
||||
else if (head->cmd == RPMSG_SOCKET_CMD_DATA)
|
||||
{
|
||||
|
@ -764,10 +764,10 @@ static int rpmsg_socket_connect_internal(FAR struct socket *psock)
|
|||
return ret;
|
||||
}
|
||||
|
||||
nxmutex_lock(&conn->recvlock);
|
||||
nxmutex_lock(&conn->sendlock);
|
||||
if (conn->sendsize == 0)
|
||||
{
|
||||
nxmutex_unlock(&conn->recvlock);
|
||||
nxmutex_unlock(&conn->sendlock);
|
||||
if (_SS_ISNONBLOCK(conn->sconn.s_flags))
|
||||
{
|
||||
return -EINPROGRESS;
|
||||
|
@ -788,7 +788,7 @@ static int rpmsg_socket_connect_internal(FAR struct socket *psock)
|
|||
}
|
||||
else
|
||||
{
|
||||
nxmutex_unlock(&conn->recvlock);
|
||||
nxmutex_unlock(&conn->sendlock);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue