Browse Source

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.
topo_upd
Evgeny 3 months ago
parent
commit
f039031883
  1. 7
      src/etcp_connections.c

7
src/etcp_connections.c

@ -1679,12 +1679,15 @@ 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) {
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 for incoming INIT from peer=0x%016llx addr=%s",
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);
}
}
}
int new_conn=0;
if (!conn || conn->peer_node_id!=peer_id) {// создаём новое подключение [new etcp]

Loading…
Cancel
Save