diff --git a/src/etcp.c b/src/etcp.c index faa60732..acbaa1c7 100644 --- a/src/etcp.c +++ b/src/etcp.c @@ -581,7 +581,7 @@ void etcp_conn_queue_set_ready(struct ETCP_CONN* conn) { if (!conn || conn->state != 0) return; // Reindex: remove old entry (key=0), add new entry with real peer_node_id - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "[%s] queue_set_ready: removing old entry=%p key=0 -> new key=0x%llx", + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "[%s] queue_set_ready: removing old entry=%p key=0 -> new key=0x%llx", conn->log_name, (void*)conn->conn_queue_entry, (unsigned long long)conn->peer_node_id); if (conn->conn_queue && conn->conn_queue_entry) { queue_remove_data(conn->conn_queue, conn->conn_queue_entry); @@ -597,7 +597,7 @@ void etcp_conn_queue_set_ready(struct ETCP_CONN* conn) { conn->conn_queue = conn->instance->connections; conn->state = 1; queue_data_put_with_index(conn->instance->connections, qe); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "[%s] queue_set_ready: new entry=%p put in queue, count=%d", + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "[%s] queue_set_ready: new entry=%p put in queue, count=%d", conn->log_name, (void*)qe, queue_entry_count(conn->instance->connections)); DEBUG_INFO(DEBUG_CATEGORY_ETCP, "[%s] moved to ready queue, state=%d peer_node_id=0x%llx", diff --git a/tools/chatgui/transport/chat_sync.c b/tools/chatgui/transport/chat_sync.c index 02d0f794..b8a196c1 100644 --- a/tools/chatgui/transport/chat_sync.c +++ b/tools/chatgui/transport/chat_sync.c @@ -434,16 +434,16 @@ static void cs_join_timeout_cb(void* arg) { /* ── helper: find active ETCP_CONN for node ── */ static struct ETCP_CONN* cs_find_conn_for_node(struct UTUN_INSTANCE* inst, uint64_t node_id) { - if (!inst->connections) { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: find_conn connections=NULL", CS_ID); return NULL; } + if (!inst->connections) { DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "%s: find_conn connections=NULL", CS_ID); return NULL; } struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id); if (e) { struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data; - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: find_conn node=%016llx found=%p initialized=%d links_up=%d state=%d", + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "%s: find_conn node=%016llx found=%p initialized=%d links_up=%d state=%d", CS_ID, (unsigned long long)node_id, (void*)ce->conn, ce->conn->initialized, ce->conn->links_up, ce->conn->state); if (ce->conn->initialized && ce->conn->links_up) return ce->conn; return NULL; } - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: find_conn node=%016llx NOT FOUND in queue (head=%p count=%d)", + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "%s: find_conn node=%016llx NOT FOUND in queue (head=%p count=%d)", CS_ID, (unsigned long long)node_id, (void*)inst->connections->head, queue_entry_count(inst->connections)); return NULL; } @@ -492,7 +492,7 @@ static void cs_on_conn_up(struct ETCP_CONN* conn, void* arg) { if (!conn || !g_cs) return; uint64_t peer = conn->peer_node_id; if (peer == 0 || peer == g_cs->inst->node_id) return; - if (!conn->initialized) { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: conn_up SKIP — not initialized peer=%016llx", CS_ID, (unsigned long long)peer); return; } + if (!conn->initialized) { DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "%s: conn_up SKIP — not initialized peer=%016llx", CS_ID, (unsigned long long)peer); return; } if (g_cs->pending_invite_ch_id != 0 && !g_cs->info_req_timer) { DEBUG_INFO(DEBUG_CATEGORY_CONNECTIVITY, "%s: conn_up invite path peer=%016llx ch=%llu", diff --git a/tools/chatgui/transport/merkle_sync.c b/tools/chatgui/transport/merkle_sync.c index 60eb8e5c..96b2f685 100644 --- a/tools/chatgui/transport/merkle_sync.c +++ b/tools/chatgui/transport/merkle_sync.c @@ -174,10 +174,11 @@ static int _get_level_hashes(struct merkle_sync* ms, const char* ns, /* ── Send helpers ── */ static struct ETCP_CONN* ms_find_conn_for_node(struct UTUN_INSTANCE* inst, uint64_t node_id) { - struct ETCP_CONN* c = inst->connections; - while (c) { - if (c->peer_node_id == node_id && c->initialized && c->links_up) return c; - c = c->next; + if (!inst->connections) return NULL; + struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id); + if (e) { + struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data; + if (ce->conn->initialized && ce->conn->links_up) return ce->conn; } return NULL; }