net/local: Return the unblock handle correctly in local_accept
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
12cc49df57
commit
75ecbd4382
|
@ -156,7 +156,7 @@ struct sock_intf_s
|
|||
FAR const struct sockaddr *addr, socklen_t addrlen);
|
||||
CODE int (*si_accept)(FAR struct socket *psock,
|
||||
FAR struct sockaddr *addr, FAR socklen_t *addrlen,
|
||||
FAR struct socket *newsock);
|
||||
FAR struct socket *newsock, int flags);
|
||||
CODE int (*si_poll)(FAR struct socket *psock,
|
||||
FAR struct pollfd *fds, bool setup);
|
||||
CODE ssize_t (*si_sendmsg)(FAR struct socket *psock,
|
||||
|
|
|
@ -76,7 +76,7 @@ static int inet_connect(FAR struct socket *psock,
|
|||
FAR const struct sockaddr *addr, socklen_t addrlen);
|
||||
static int inet_accept(FAR struct socket *psock,
|
||||
FAR struct sockaddr *addr, FAR socklen_t *addrlen,
|
||||
FAR struct socket *newsock);
|
||||
FAR struct socket *newsock, int flags);
|
||||
static int inet_poll(FAR struct socket *psock,
|
||||
FAR struct pollfd *fds, bool setup);
|
||||
static ssize_t inet_send(FAR struct socket *psock, FAR const void *buf,
|
||||
|
@ -1369,7 +1369,8 @@ static int inet_connect(FAR struct socket *psock,
|
|||
****************************************************************************/
|
||||
|
||||
static int inet_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock)
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock,
|
||||
int flags)
|
||||
{
|
||||
#if defined(CONFIG_NET_TCP) && defined(NET_TCP_HAVE_STACK)
|
||||
int ret;
|
||||
|
|
|
@ -347,7 +347,8 @@ int local_listen(FAR struct socket *psock, int backlog);
|
|||
|
||||
#ifdef CONFIG_NET_LOCAL_STREAM
|
||||
int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock);
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock,
|
||||
int flags);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -96,12 +96,14 @@ static int local_waitlisten(FAR struct local_conn_s *server)
|
|||
****************************************************************************/
|
||||
|
||||
int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock)
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock,
|
||||
int flags)
|
||||
{
|
||||
FAR struct local_conn_s *server;
|
||||
FAR struct local_conn_s *client;
|
||||
FAR struct local_conn_s *conn;
|
||||
FAR dq_entry_t *waiter;
|
||||
bool nonblock = !!(flags & SOCK_NONBLOCK);
|
||||
int ret;
|
||||
|
||||
/* Some sanity checks */
|
||||
|
@ -180,7 +182,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
* block.
|
||||
*/
|
||||
|
||||
ret = local_open_server_tx(conn, false);
|
||||
ret = local_open_server_tx(conn, nonblock);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: Failed to open write-only FIFOs for %s: %d\n",
|
||||
|
@ -199,7 +201,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
* for writing.
|
||||
*/
|
||||
|
||||
ret = local_open_server_rx(conn, false);
|
||||
ret = local_open_server_rx(conn, nonblock);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: Failed to open read-only FIFOs for %s: %d\n",
|
||||
|
|
|
@ -141,7 +141,7 @@ static int rpmsg_socket_connect(FAR struct socket *psock,
|
|||
FAR const struct sockaddr *addr, socklen_t addrlen);
|
||||
static int rpmsg_socket_accept(FAR struct socket *psock,
|
||||
FAR struct sockaddr *addr, FAR socklen_t *addrlen,
|
||||
FAR struct socket *newsock);
|
||||
FAR struct socket *newsock, int flags);
|
||||
static int rpmsg_socket_poll(FAR struct socket *psock,
|
||||
FAR struct pollfd *fds, bool setup);
|
||||
static ssize_t rpmsg_socket_sendmsg(FAR struct socket *psock,
|
||||
|
@ -737,7 +737,8 @@ static int rpmsg_socket_connect(FAR struct socket *psock,
|
|||
static int rpmsg_socket_accept(FAR struct socket *psock,
|
||||
FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen,
|
||||
FAR struct socket *newsock)
|
||||
FAR struct socket *newsock,
|
||||
int flags)
|
||||
{
|
||||
FAR struct rpmsg_socket_conn_s *server = psock->s_conn;
|
||||
int ret = 0;
|
||||
|
@ -787,7 +788,6 @@ static int rpmsg_socket_accept(FAR struct socket *psock,
|
|||
newsock->s_conn = conn;
|
||||
|
||||
rpmsg_socket_getaddr(conn, addr, addrlen);
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -146,7 +146,7 @@ int psock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
}
|
||||
|
||||
net_lock();
|
||||
ret = psock->s_sockif->si_accept(psock, addr, addrlen, newsock);
|
||||
ret = psock->s_sockif->si_accept(psock, addr, addrlen, newsock, flags);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Mark the new socket as connected. */
|
||||
|
|
|
@ -448,7 +448,8 @@ int usrsock_listen(FAR struct socket *psock, int backlog);
|
|||
****************************************************************************/
|
||||
|
||||
int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock);
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock,
|
||||
int flags);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: usrsock_poll
|
||||
|
|
|
@ -213,7 +213,8 @@ static int do_accept_request(FAR struct usrsock_conn_s *conn,
|
|||
****************************************************************************/
|
||||
|
||||
int usrsock_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock)
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock,
|
||||
int flags)
|
||||
{
|
||||
FAR struct usrsock_conn_s *conn = psock->s_conn;
|
||||
struct usrsock_data_reqstate_s state =
|
||||
|
|
Loading…
Reference in New Issue