local_socket: set lc_peer when accept() instead of connect()
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
dbaf8a92b4
commit
1970ce5116
|
@ -170,6 +170,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||||
conn->lc_psock = psock;
|
conn->lc_psock = psock;
|
||||||
#ifdef CONFIG_NET_LOCAL_SCM
|
#ifdef CONFIG_NET_LOCAL_SCM
|
||||||
conn->lc_peer = client;
|
conn->lc_peer = client;
|
||||||
|
client->lc_peer = conn;
|
||||||
#endif /* CONFIG_NET_LOCAL_SCM */
|
#endif /* CONFIG_NET_LOCAL_SCM */
|
||||||
|
|
||||||
strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1);
|
strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1);
|
||||||
|
|
|
@ -176,6 +176,7 @@ void local_free(FAR struct local_conn_s *conn)
|
||||||
if (local_peerconn(conn) && conn->lc_peer)
|
if (local_peerconn(conn) && conn->lc_peer)
|
||||||
{
|
{
|
||||||
conn->lc_peer->lc_peer = NULL;
|
conn->lc_peer->lc_peer = NULL;
|
||||||
|
conn->lc_peer = NULL;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NET_LOCAL_SCM */
|
#endif /* CONFIG_NET_LOCAL_SCM */
|
||||||
|
|
||||||
|
|
|
@ -301,9 +301,6 @@ int psock_local_connect(FAR struct socket *psock,
|
||||||
UNIX_PATH_MAX - 1);
|
UNIX_PATH_MAX - 1);
|
||||||
client->lc_path[UNIX_PATH_MAX - 1] = '\0';
|
client->lc_path[UNIX_PATH_MAX - 1] = '\0';
|
||||||
client->lc_instance_id = local_generate_instance_id();
|
client->lc_instance_id = local_generate_instance_id();
|
||||||
#ifdef CONFIG_NET_LOCAL_SCM
|
|
||||||
client->lc_peer = conn;
|
|
||||||
#endif /* CONFIG_NET_LOCAL_SCM */
|
|
||||||
|
|
||||||
/* The client is now bound to an address */
|
/* The client is now bound to an address */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue