Keep BLE candidate monitoring separate from IP probes

This commit is contained in:
evgeny committed 2026-10-30 19:15:17 +01:00
1 parent ca04b098f8
commit 2d4b2f10a6
1 file changed
+22 -1
+22 -1
View File
@@ -8,6 +8,7 @@
#include "utun_instance.h"
#include "etcp.h"
#include "etcp_connections.h"
#include "etcp_link_io.h"
#include "etcp_router.h"
#include "topo_node.h"
#include "topo_group.h"
@@ -227,9 +228,29 @@ void cm_candidate_ping_timer_cb(void* arg) {
struct TOPO_NODE* ni = topo_node_registry_find(mgr->instance->topo_groups, nq->node_id);
/* пир в SLEEP-фазе — прямое соединение живо, пинг будит его: пропускаем */
if (ni && !dc->peer_sleep_phase) {
/* BLE и другие пакетные драйверы живут через ETCP keepalive, без IP-проб.
* При нескольких транспортах ищем живой IP-путь, не исключая пира из кандидатов. */
struct etcp_link_snapshot transport;
for (; link; link = link->next) {
if (!link->initialized || !link->link_status || link->closing) continue;
if (etcp_link_get_snapshot(link, &transport)) continue;
if (!transport.has_ip) {
DEBUG_DEBUG(DEBUG_CATEGORY_BGP,
"candidate probe skipped: peer=%016llx link=%u transport=%s reason=non-IP; ETCP keepalive active",
(unsigned long long)nid, link->local_link_id, transport.protocol);
continue;
}
if (link->remote_addr.ss_family != AF_INET && link->remote_addr.ss_family != AF_INET6) {
DEBUG_WARN(DEBUG_CATEGORY_BGP, "candidate probe invalid IP address: peer=%016llx link=%u transport=%s family=%d",
(unsigned long long)nid, link->local_link_id, transport.protocol, link->remote_addr.ss_family);
continue;
}
break;
}
if (!link) continue;
DEBUG_TRACE(DEBUG_CATEGORY_BGP, "candidate probe: group=%016llx peer=%016llx link=%u transport=%s",
(unsigned long long)mgr->group->group_id, (unsigned long long)nid, link->local_link_id,
link->is_tcp ? "TCP" : "UDP");
transport.protocol);
if (link->is_tcp) {
struct stcp_client** slot = NULL;
for (uint8_t i = 0; i < CONN_MGR_MAX_CANDIDATES; i++)