usrsock: delete sock->s_crefs to fix compile break

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2021-02-25 12:14:59 +08:00 committed by Xiang Xiao
parent 459916f81c
commit 0e1148cf1d

View File

@ -207,13 +207,11 @@ static int usrsock_rpmsg_socket_handler(struct rpmsg_endpoint *ept,
for (i = 0; i < CONFIG_NFILE_DESCRIPTORS; i++)
{
pthread_mutex_lock(&priv->mutex);
if (priv->socks[i].s_crefs == 0)
if (priv->socks[i].s_conn == NULL)
{
priv->socks[i].s_crefs++;
pthread_mutex_unlock(&priv->mutex);
ret = psock_socket(req->domain, req->type, req->protocol,
&priv->socks[i]);
pthread_mutex_unlock(&priv->mutex);
if (ret >= 0)
{
psock_fcntl(&priv->socks[i], F_SETFL,
@ -222,10 +220,6 @@ static int usrsock_rpmsg_socket_handler(struct rpmsg_endpoint *ept,
priv->epts[i] = ept;
ret = i; /* Return index as the usockid */
}
else
{
priv->socks[i].s_crefs--;
}
break;
}
@ -553,14 +547,12 @@ static int usrsock_rpmsg_accept_handler(struct rpmsg_endpoint *ept,
for (i = 0; i < CONFIG_NFILE_DESCRIPTORS; i++)
{
pthread_mutex_lock(&priv->mutex);
if (priv->socks[i].s_crefs == 0)
if (priv->socks[i].s_conn == NULL)
{
priv->socks[i].s_crefs++;
pthread_mutex_unlock(&priv->mutex);
ret = psock_accept(&priv->socks[req->usockid],
outaddrlen ? (struct sockaddr *)(ack + 1) : NULL,
outaddrlen ? &outaddrlen : NULL, &priv->socks[i]);
pthread_mutex_unlock(&priv->mutex);
if (ret >= 0)
{
psock_fcntl(&priv->socks[i], F_SETFL,
@ -581,10 +573,6 @@ static int usrsock_rpmsg_accept_handler(struct rpmsg_endpoint *ept,
ret = sizeof(int16_t); /* Return usockid size */
}
else
{
priv->socks[i].s_crefs--;
}
break;
}