Prune unconfirmed BGP paths and restart stalled exchanges

This commit is contained in:
evgeny committed 2026-09-28 14:58:13 +03:00
1 parent b76e6553bc
commit 39ce249361
5 files changed
+110 -6

No files matched your search

+5
View File
@@ -144,6 +144,11 @@ int main(void) {
create();
unsigned triangle = edge(0, 1) | edge(1, 2) | edge(0, 2) | edge(2, 3);
change(triangle); settle(); verify();
/* One-sided REINIT with routes retained, then simultaneous REINIT at all peers. */
etcp_fire_conn_status(conns[0][1], ETCP_CONN_STATUS_REINIT); settle(); verify();
for (int a = 0; a < N; a++) for (int b = 0; b < N; b++)
if (graph & edge(a, b)) etcp_fire_conn_status(conns[a][b], ETCP_CONN_STATUS_REINIT);
settle(); verify();
change(triangle & ~edge(0, 2)); settle(); verify();
change(triangle); settle(); verify();
change(triangle & ~edge(1, 2) & ~edge(0, 2)); settle(); verify();
+22 -1
View File
@@ -8,6 +8,7 @@
#include "transport_layer/node_conn_direct.h"
#include "../lib/u_async.h"
#include "../lib/debug_config.h"
#include "../lib/platform_compat.h"
static struct TOPO_GROUP_CONN_ITEM* peer(struct TOPO_GROUP* group) {
assert(group->senders_list->head && !group->senders_list->head->next);
@@ -153,8 +154,15 @@ int main(void) {
assert(!peer(a)->table_sent);
assert(peer(a)->tx_failed);
conn->send_input_q->size_limit = saved_limit;
etcp_fire_conn_status(conn, ETCP_CONN_STATUS_REINIT);
/* Watchdog must recover a failed sender without a transport status callback. */
uint64_t failed_epoch = peer(a)->local_epoch;
peer(a)->progress = get_time_tb() - TOPO_GROUP_SYNC_TIMEOUT_MS * 10ULL - 1;
uint64_t deadline = get_time_tb() + 10000;
while (peer(a)->local_epoch == failed_epoch && get_time_tb() < deadline) uasync_poll(ua, 10);
assert(peer(a)->local_epoch != failed_epoch && !peer(a)->tx_failed);
assert(!topo_node_find_by_id(a, node.node_id)); /* incomplete snapshot expired */
accept_join(a, conn);
nodeinfo(a, conn, &node, &keys, peer(a)->local_epoch, 1);
complete(a, conn, peer(a)->local_epoch); request(a, conn);
assert(topo_group_peer_ready(a, node.node_id));
@@ -169,6 +177,19 @@ int main(void) {
assert(topo_node_find_by_id(a, node.node_id));
wd.h.dst_epoch = peer(a)->local_epoch; packet(conn, &wd, sizeof(wd));
assert(!topo_node_find_by_id(a, node.node_id));
/* Same identity in a new exchange confirms a path; omission removes only that peer's path. */
nodeinfo(a, conn, &node, &keys, peer(a)->local_epoch, 2);
etcp_fire_conn_status(conn, ETCP_CONN_STATUS_REINIT); accept_join(a, conn);
nodeinfo(a, conn, &node, &keys, peer(a)->local_epoch, 2);
complete(a, conn, peer(a)->local_epoch); request(a, conn);
assert(topo_group_find_conn_for_node(a, node.node_id) == conn && !peer(a)->exchange_timer);
routed = topo_node_find_by_id(a, node.node_id);
assert(topo_group_add_path(routed, &relay, relay_hops, 2, 10) == 0);
etcp_fire_conn_status(conn, ETCP_CONN_STATUS_REINIT); accept_join(a, conn);
complete(a, conn, peer(a)->local_epoch); request(a, conn);
assert(topo_group_find_conn_for_node(a, node.node_id) == &relay && queue_entry_count(routed->paths) == 1);
assert(topo_group_process_withdraw(a, &relay, (const uint8_t*)&alternate_wd, sizeof(alternate_wd)) == 0);
assert(!topo_node_find_by_id(a, node.node_id));
a_id = peer(a)->local_epoch;
topo_group_remove_conn(a, conn, TOPO_REMOVE_LOCAL_LEAVE);
complete(a, conn, a_id);
+2
View File
@@ -74,6 +74,8 @@ static void route(struct fixture* f, int target, int via) {
topo_node_registry_ref(f->inst->topo_groups, node->node_id);
uint64_t hops[] = { node->node_id, f->ids[via] };
assert(topo_group_add_path(node, f->conns[via], hops, target == via ? 1 : 2, 10) == 0);
/* This fixture injects the route that a NODEINFO of the current exchange would confirm. */
if (peer(f, via)) ((struct TOPO_NODEPATH*)node->paths->tail)->exchange = peer(f, via)->local_epoch;
assert(queue_data_put_with_index(f->group->nodes, entry) == 0);
topo_recovery_changed(f->group);
}