call: ретрансмит INVITE каждые 2с + fail-fast при отсутствии маршрута (6с)
This commit is contained in:
1 parent
93becd36e6
commit
0e625da109
8 files changed
+128
-20
No files matched your search
@@ -194,21 +194,30 @@ static struct ETCP_ROUTER_CONN* router_conn_find(struct UTUN_INSTANCE* inst,
|
||||
// ====================================================================
|
||||
|
||||
// Найти ETCP_CONN для отправки (учитывая indirect-посредников). NULL = нет маршрута.
|
||||
static struct ETCP_CONN* router_send_conn(struct ETCP_ROUTER_CONN* rconn) {
|
||||
struct UTUN_INSTANCE* inst = rconn->inst;
|
||||
struct TOPO_GROUP* group = topo_groups_find(inst->topo_groups, rconn->group_id);
|
||||
static struct ETCP_CONN* router_route_conn(struct UTUN_INSTANCE* inst, uint64_t group_id, uint64_t remote_node_id) {
|
||||
struct TOPO_GROUP* group = topo_groups_find(inst->topo_groups, group_id);
|
||||
if (group) {
|
||||
struct TOPO_GROUP_NODE* nq = topo_node_find_by_id(group, rconn->remote_node_id);
|
||||
struct TOPO_GROUP_NODE* nq = topo_node_find_by_id(group, remote_node_id);
|
||||
if (nq && nq->conn_mgr_type == CONN_TYPE_INDIRECT && nq->conn_mgr_intermediariy_count > 0) {
|
||||
for (uint8_t i = 0; i < nq->conn_mgr_intermediariy_count; i++) {
|
||||
struct ETCP_CONN* c = topo_group_find_conn_for_node(group, nq->conn_mgr_intermediaries[i]);
|
||||
if (c) return c;
|
||||
}
|
||||
}
|
||||
return topo_group_find_conn_for_node(group, rconn->remote_node_id);
|
||||
return topo_group_find_conn_for_node(group, remote_node_id);
|
||||
}
|
||||
/* group_id=0 (или группа не найдена) — глобальная маршрутизация: прямое соединение по node_id */
|
||||
return instance_find_conn(inst, rconn->remote_node_id);
|
||||
return instance_find_conn(inst, remote_node_id);
|
||||
}
|
||||
|
||||
static struct ETCP_CONN* router_send_conn(struct ETCP_ROUTER_CONN* rconn) {
|
||||
return router_route_conn(rconn->inst, rconn->group_id, rconn->remote_node_id);
|
||||
}
|
||||
|
||||
int etcp_router_has_route(struct UTUN_INSTANCE* inst, uint64_t group_id, uint64_t dst_node_id) {
|
||||
if (!inst) return 0;
|
||||
if (dst_node_id == inst->node_id) return 1;
|
||||
return router_route_conn(inst, group_id, dst_node_id) != NULL;
|
||||
}
|
||||
|
||||
// Собрать и закодировать (подпись/шифрование) пакет в начале отправки.
|
||||
|
||||
@@ -207,6 +207,10 @@ int etcp_route_send(struct UTUN_INSTANCE* inst, uint64_t group_id, uint64_t dst
|
||||
struct ETCP_ROUTER_CONN* etcp_router_conn_get(struct UTUN_INSTANCE* inst,
|
||||
uint64_t group_id, uint64_t remote_node_id, uint8_t svc_id);
|
||||
|
||||
// Есть ли сейчас физический маршрут до узла (прямой, indirect-посредник или глобальный).
|
||||
// 1 = есть ETCP-соединение для отправки, 0 = нет (передача встанет в no_route).
|
||||
int etcp_router_has_route(struct UTUN_INSTANCE* inst, uint64_t group_id, uint64_t dst_node_id);
|
||||
|
||||
// Отправить данные с авто-seq и контролем inflight
|
||||
// data: payload без svc_id, mode: ROUTE_CRYPTO_SIGN / ROUTE_CRYPTO_ENCRYPT (0 = обычный)
|
||||
int etcp_router_conn_send(struct ETCP_ROUTER_CONN* rconn,
|
||||
|
||||
Reference in new issue
Block a user