mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
net/local: fix accept for local stream sockets
This commit is contained in:
parent
20dc5ad3b4
commit
52becb7811
2 changed files with 8 additions and 5 deletions
|
@ -359,7 +359,7 @@ 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 void **newconn);
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -111,8 +111,7 @@ 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 void **newconn)
|
||||
|
||||
FAR socklen_t *addrlen, FAR struct socket *newsock)
|
||||
{
|
||||
FAR struct local_conn_s *server;
|
||||
FAR struct local_conn_s *client;
|
||||
|
@ -122,6 +121,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
/* Some sanity checks */
|
||||
|
||||
DEBUGASSERT(psock && psock->s_conn);
|
||||
DEBUGASSERT(newsock && !newsock->s_conn);
|
||||
|
||||
/* Is the socket a stream? */
|
||||
|
||||
|
@ -233,9 +233,12 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
|
||||
if (ret == OK)
|
||||
{
|
||||
/* Return the client connection structure */
|
||||
/* Setup the client socket structure */
|
||||
|
||||
*newconn = (FAR void *)conn;
|
||||
newsock->s_domain = psock->s_domain;
|
||||
newsock->s_type = SOCK_STREAM;
|
||||
newsock->s_sockif = psock->s_sockif;
|
||||
newsock->s_conn = (FAR void *)conn;
|
||||
}
|
||||
|
||||
/* Signal the client with the result of the connection */
|
||||
|
|
Loading…
Reference in a new issue