net/local: replace the common connect prologue
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
3d62d5106d
commit
af1cf5eaae
|
@ -118,20 +118,7 @@ struct local_conn_s
|
|||
{
|
||||
/* Common prologue of all connection structures. */
|
||||
|
||||
/* lc_node supports a doubly linked list: Listening SOCK_STREAM servers
|
||||
* will be linked into a list of listeners; SOCK_STREAM clients will be
|
||||
* linked to the lc_conn lists.
|
||||
*/
|
||||
|
||||
dq_entry_t lc_node; /* Supports a doubly linked list */
|
||||
|
||||
/* This is a list of Local connection callbacks. Each callback represents
|
||||
* a thread that is stalled, waiting for a device-specific event.
|
||||
* REVISIT: Here for commonality with other connection structures; not
|
||||
* used in the current implementation.
|
||||
*/
|
||||
|
||||
FAR struct devif_callback_s *lc_list;
|
||||
struct socket_conn_s lc_conn;
|
||||
|
||||
/* Local-socket specific content follows */
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ FAR struct local_conn_s *local_nextconn(FAR struct local_conn_s *conn)
|
|||
return (FAR struct local_conn_s *)g_local_connections.head;
|
||||
}
|
||||
|
||||
return (FAR struct local_conn_s *)conn->lc_node.flink;
|
||||
return (FAR struct local_conn_s *)conn->lc_conn.node.flink;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -143,7 +143,7 @@ FAR struct local_conn_s *local_alloc(void)
|
|||
/* Add the connection structure to the list of listeners */
|
||||
|
||||
net_lock();
|
||||
dq_addlast(&conn->lc_node, &g_local_connections);
|
||||
dq_addlast(&conn->lc_conn.node, &g_local_connections);
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ void local_free(FAR struct local_conn_s *conn)
|
|||
/* Remove the server from the list of listeners. */
|
||||
|
||||
net_lock();
|
||||
dq_rem(&conn->lc_node, &g_local_connections);
|
||||
dq_rem(&conn->lc_conn.node, &g_local_connections);
|
||||
|
||||
#ifdef CONFIG_NET_LOCAL_SCM
|
||||
if (local_peerconn(conn) && conn->lc_peer)
|
||||
|
|
|
@ -107,7 +107,7 @@ int local_listen(FAR struct socket *psock, int backlog)
|
|||
{
|
||||
/* The connection should not reside in any other list */
|
||||
|
||||
DEBUGASSERT(server->lc_node.flink == NULL);
|
||||
DEBUGASSERT(server->lc_conn.node.flink == NULL);
|
||||
|
||||
/* And change the server state to listing */
|
||||
|
||||
|
|
Loading…
Reference in New Issue