netutils/usrsock_rpmsg: Switch the nonblocking mode by psock_ioctl instead
since it's more simpler than psock_ioctl Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
02a095bb76
commit
f31cc67da8
@ -25,12 +25,12 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/eventfd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <nuttx/net/dns.h>
|
||||
#include <nuttx/net/net.h>
|
||||
@ -212,14 +212,11 @@ static int usrsock_rpmsg_socket_handler(struct rpmsg_endpoint *ept,
|
||||
pthread_mutex_lock(&priv->mutex);
|
||||
if (priv->socks[i].s_conn == NULL)
|
||||
{
|
||||
ret = psock_socket(req->domain, req->type, req->protocol,
|
||||
&priv->socks[i]);
|
||||
ret = psock_socket(req->domain, req->type | SOCK_NONBLOCK,
|
||||
req->protocol, &priv->socks[i]);
|
||||
pthread_mutex_unlock(&priv->mutex);
|
||||
if (ret >= 0)
|
||||
{
|
||||
psock_fcntl(&priv->socks[i], F_SETFL,
|
||||
psock_fcntl(&priv->socks[i], F_GETFL) | O_NONBLOCK);
|
||||
|
||||
priv->epts[i] = ept;
|
||||
ret = i; /* Return index as the usockid */
|
||||
}
|
||||
@ -664,9 +661,9 @@ static int usrsock_rpmsg_accept_handler(struct rpmsg_endpoint *ept,
|
||||
pthread_mutex_unlock(&priv->mutex);
|
||||
if (ret >= 0)
|
||||
{
|
||||
psock_fcntl(&priv->socks[i], F_SETFL,
|
||||
psock_fcntl(&priv->socks[i], F_GETFL) | O_NONBLOCK);
|
||||
int nonblock = 1;
|
||||
|
||||
psock_ioctl(&priv->socks[i], FIONBIO, &nonblock);
|
||||
priv->epts[i] = ept;
|
||||
|
||||
/* Append index as usockid to the payload */
|
||||
|
Loading…
Reference in New Issue
Block a user