topo_group: асимметричный старт BGP (JOIN_GROUP) + вынос group_id/flags из TOPO_NODE
- UTUN: BGP инициирует только сторона-клиент ([client]) и явные etcp_connect; сервер добавляет пира по JOIN_GROUP (фикс обратного маршрута: сервер не создавал узел клиента из-за дедупа senders_list) - topo_group_new_conn: conn_add_path до дедупа; handle_request_table без add_to_senders - TOPO_NODE: убраны group_id/flags (shared-реестр), передаются в topo_node_serialize - routing/control_server: явный TOPO_GROUP_UTUN - CHAT: гейт по peers_* (get_member_channels) + пассивное add/remove в member_sync - tests: тесты адаптированы (route_ping ждёт registry+v4_addrs) - chatgui-android: voice_recorder_init в utun_bridge_voice_start (idempotent)
This commit is contained in:
1 parent
7b73d99b5b
commit
656da48e35
20 files changed
+236
-46
No files matched your search
@@ -160,7 +160,7 @@ static struct TOPO_GROUP_NODE* mk_srv_node(void) {
|
||||
struct TOPO_GROUP_NODE* nq = u_calloc(1, sizeof(struct TOPO_GROUP_NODE));
|
||||
struct TOPO_NODE* ni = u_calloc(1, sizeof(struct TOPO_NODE));
|
||||
if (!nq || !ni) { u_free(nq); u_free(ni); return NULL; }
|
||||
ni->group_ref_count = 1; ni->node_id = ctx.srv_node_id; ni->group_id = TOPO_GROUP_UTUN;
|
||||
ni->group_ref_count = 1; ni->node_id = ctx.srv_node_id;
|
||||
memcpy(ni->public_key, ctx.srv_pubkey, SC_PUBKEY_SIZE);
|
||||
nq->ll.size = sizeof(struct TOPO_GROUP_NODE) - sizeof(struct ll_entry);
|
||||
nq->node_id = ctx.srv_node_id;
|
||||
|
||||
@@ -72,7 +72,7 @@ static struct TOPO_GROUP_NODE* mknode(struct UTUN_INSTANCE* inst, uint64_t nid,
|
||||
struct TOPO_GROUP_NODE* nq = u_calloc(1, sizeof(struct TOPO_GROUP_NODE));
|
||||
struct TOPO_NODE* ni = u_calloc(1, sizeof(struct TOPO_NODE));
|
||||
if (!nq || !ni) { u_free(nq); u_free(ni); return NULL; }
|
||||
ni->group_ref_count = 1; ni->node_id = nid; ni->ver = 0; ni->group_id = TOPO_GROUP_UTUN;
|
||||
ni->group_ref_count = 1; ni->node_id = nid; ni->ver = 0;
|
||||
memcpy(ni->public_key, pubkey, SC_PUBKEY_SIZE);
|
||||
nq->ll.size = sizeof(struct TOPO_GROUP_NODE) - sizeof(struct ll_entry);
|
||||
nq->node_id = nid;
|
||||
|
||||
@@ -83,7 +83,7 @@ static struct TOPO_GROUP_NODE* mknode(struct UTUN_INSTANCE* inst, uint64_t nid,
|
||||
struct TOPO_GROUP_NODE* nq = u_calloc(1, sizeof(struct TOPO_GROUP_NODE));
|
||||
struct TOPO_NODE* ni = u_calloc(1, sizeof(struct TOPO_NODE));
|
||||
if (!nq || !ni) { u_free(nq); u_free(ni); return NULL; }
|
||||
ni->group_ref_count = 1; ni->node_id = nid; ni->ver = 0; ni->group_id = TOPO_GROUP_UTUN;
|
||||
ni->group_ref_count = 1; ni->node_id = nid; ni->ver = 0;
|
||||
memcpy(ni->public_key, pubkey, SC_PUBKEY_SIZE);
|
||||
nq->ll.size = sizeof(struct TOPO_GROUP_NODE) - sizeof(struct ll_entry);
|
||||
nq->node_id = nid;
|
||||
|
||||
@@ -241,18 +241,19 @@ int main(void) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// 2. Wait for BGP exchange so B learns about C
|
||||
// 2. Wait for BGP exchange so B learns C (registry has C's nodeinfo + addresses)
|
||||
DEBUG_INFO(DEBUG_CATEGORY_BGP, "Waiting for BGP exchange (B learns C)...");
|
||||
int bgp_wait_cycles = 0;
|
||||
while (!test_timed_out && bgp_wait_cycles < 500) {
|
||||
if (topo_groups_get_default(inst_b->topo_groups) && topo_node_find_by_id(topo_groups_get_default(inst_b->topo_groups), g_node_id_c) != NULL) {
|
||||
struct TOPO_NODE* ni_c = topo_node_registry_find(inst_b->topo_groups, g_node_id_c);
|
||||
if (ni_c && ni_c->v4_addrs) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_BGP, "B learned about C");
|
||||
break;
|
||||
}
|
||||
uasync_poll(ua, 10);
|
||||
bgp_wait_cycles++;
|
||||
}
|
||||
if (!topo_groups_get_default(inst_b->topo_groups) || topo_node_find_by_id(topo_groups_get_default(inst_b->topo_groups), g_node_id_c) == NULL) {
|
||||
if (!topo_node_registry_find(inst_b->topo_groups, g_node_id_c)) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "B did not learn about C in time");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user