This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 1970ce5116b1c3e57866df09e5b47610bf68e1b0 Author: ligd <[email protected]> AuthorDate: Fri Oct 15 18:36:30 2021 +0800 local_socket: set lc_peer when accept() instead of connect() Signed-off-by: ligd <[email protected]> --- net/local/local_accept.c | 1 + net/local/local_conn.c | 1 + net/local/local_connect.c | 3 --- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/net/local/local_accept.c b/net/local/local_accept.c index 8d4bec5..c951b88 100644 --- a/net/local/local_accept.c +++ b/net/local/local_accept.c @@ -170,6 +170,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr, conn->lc_psock = psock; #ifdef CONFIG_NET_LOCAL_SCM conn->lc_peer = client; + client->lc_peer = conn; #endif /* CONFIG_NET_LOCAL_SCM */ strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1); diff --git a/net/local/local_conn.c b/net/local/local_conn.c index c968cca..a32c874 100644 --- a/net/local/local_conn.c +++ b/net/local/local_conn.c @@ -176,6 +176,7 @@ void local_free(FAR struct local_conn_s *conn) if (local_peerconn(conn) && conn->lc_peer) { conn->lc_peer->lc_peer = NULL; + conn->lc_peer = NULL; } #endif /* CONFIG_NET_LOCAL_SCM */ diff --git a/net/local/local_connect.c b/net/local/local_connect.c index 1c3f407..b3aff31 100644 --- a/net/local/local_connect.c +++ b/net/local/local_connect.c @@ -301,9 +301,6 @@ int psock_local_connect(FAR struct socket *psock, UNIX_PATH_MAX - 1); client->lc_path[UNIX_PATH_MAX - 1] = '\0'; 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 */
