fix: check conn_queue_entry->peer_node_id instead of conn->peer_node_id

etcp_conn_set_peer_node_id at state=0 updates conn->peer_node_id but
does not reindex the queue entry (key stays 0). Check the queue entry
directly to detect unindexed outbound connections.
This commit is contained in:
Evgeny committed 2026-07-16 21:05:08 +03:00
1 parent c3354938e1
commit f039031883
1 file changed
+7 -4
+7 -4
View File
@@ -1679,10 +1679,13 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
}
if (!conn) {
struct ETCP_LINK* ol = etcp_link_find_by_addr(e_sock, &addr);
if (ol && ol->etcp && ol->etcp->peer_node_id == 0) {
conn = ol->etcp;
DEBUG_INFO(DEBUG_CATEGORY_CONNECTION, "[%s] reusing unindexed outbound conn for incoming INIT from peer=0x%016llx addr=%s",
conn->log_name, (unsigned long long)peer_id, sockaddr_storage_to_str(&addr).str);
if (ol && ol->etcp && ol->etcp->conn_queue_entry) {
struct conn_queue_entry* ce = (struct conn_queue_entry*)ol->etcp->conn_queue_entry->data;
if (ce->peer_node_id == 0) {
conn = ol->etcp;
DEBUG_INFO(DEBUG_CATEGORY_CONNECTION, "[%s] reusing unindexed outbound conn (q_key=0, peer=0x%016llx) for incoming INIT from %s",
conn->log_name, (unsigned long long)peer_id, sockaddr_storage_to_str(&addr).str);
}
}
}