Skip to content

Commit 54d05ef

Browse files
jukkarnashif
authored andcommitted
net: tcp2: Use pointer to slist node
Instead of forcing the slist node to be first in the tcp struct, use the pointer to node when accessing the slist. This way we can change the ordering of fields in tcp struct. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 2b44573 commit 54d05ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/net/ip/tcp2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static int tcp_conn_unref(struct tcp *conn)
326326

327327
k_delayed_work_cancel(&conn->timewait_timer);
328328

329-
sys_slist_find_and_remove(&tcp_conns, (sys_snode_t *)conn);
329+
sys_slist_find_and_remove(&tcp_conns, &conn->next);
330330

331331
memset(conn, 0, sizeof(*conn));
332332

@@ -893,7 +893,7 @@ static struct tcp *tcp_conn_alloc(void)
893893

894894
tcp_conn_ref(conn);
895895

896-
sys_slist_append(&tcp_conns, (sys_snode_t *)conn);
896+
sys_slist_append(&tcp_conns, &conn->next);
897897
out:
898898
NET_DBG("conn: %p", conn);
899899

0 commit comments

Comments
 (0)