From 1e7585438d5bec85f0edc69625b66d3f1ed66805 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Wed, 15 Jul 2026 11:05:27 +0300 Subject: [PATCH] chat_core_connect_auto: add outbound conn to inst->connections etcp_connection_create does NOT add conn to inst->connections list. Without this, incoming INIT handler can't find the outbound conn by peer_node_id and creates a new one, causing insert_link collision. --- tools/chatgui/transport/chat_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/chatgui/transport/chat_core.c b/tools/chatgui/transport/chat_core.c index 5ad83d36..fea51051 100644 --- a/tools/chatgui/transport/chat_core.c +++ b/tools/chatgui/transport/chat_core.c @@ -1051,6 +1051,9 @@ void chat_core_connect_auto(uint64_t node_id, sc_init_ctx(&conn->crypto_ctx, &g_cc.inst->my_keys); sc_set_peer_public_key(&conn->crypto_ctx, pubkey, 0); conn->peer_node_id = node_id; + conn->next = g_cc.inst->connections; + g_cc.inst->connections = conn; + g_cc.inst->connections_count++; struct ca_ctx* pctx = u_calloc(1, sizeof(struct ca_ctx)); if (!pctx) { etcp_connection_close(conn); pst->conns[i] = NULL; pst->timers[i] = NULL; pst->pending_count--; continue; }