From df346fc09705eb2ce9a6669b4b13a58d4851f23a Mon Sep 17 00:00:00 2001 From: evgeny Date: Fri, 2 Oct 2026 12:04:34 +0300 Subject: [PATCH] Log standby retry transitions and await the actual wake phase --- src/routing_layer/topo_group_connect.c | 9 ++++++++- tests/test_group_connect.c | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routing_layer/topo_group_connect.c b/src/routing_layer/topo_group_connect.c index 1f57a480..8e3dbe45 100644 --- a/src/routing_layer/topo_group_connect.c +++ b/src/routing_layer/topo_group_connect.c @@ -173,6 +173,8 @@ static void tgc_cancel_pause(struct TOPO_GROUP_CONNECT* gc) { static void tgc_resume(void* arg) { struct TOPO_GROUP_CONNECT* gc = arg; gc->pause_wait = NULL; gc->paused = 0; + DEBUG_INFO(DEBUG_CATEGORY_BGP, "group connect standby resumed: group=%016llx", + (unsigned long long)gc->group->group_id); topo_group_connect_changed(gc->group); } #endif @@ -181,7 +183,12 @@ static int tgc_pause(struct TOPO_GROUP_CONNECT* gc) { #ifdef UTUN_HAVE_STANDBY if (standby_get_sleep_tb() > 0) { gc->pause_wait = standby_wait(gc, tgc_resume); - if (gc->pause_wait) { gc->paused = 1; return 1; } + if (gc->pause_wait) { + gc->paused = 1; + DEBUG_INFO(DEBUG_CATEGORY_BGP, "group connect standby wait: group=%016llx sleep_ms=%d", + (unsigned long long)gc->group->group_id, standby_get_sleep_tb() / 10); + return 1; + } DEBUG_WARN(DEBUG_CATEGORY_BGP, "cannot wait for standby; using group retry timer"); } #endif diff --git a/tests/test_group_connect.c b/tests/test_group_connect.c index d2c0ed57..954bad33 100644 --- a/tests/test_group_connect.c +++ b/tests/test_group_connect.c @@ -244,7 +244,8 @@ static void standby_down(void) { while (!standby_get_sleep_tb()) uasync_poll(f.ua, 100); assert(topo_group_connect_init(f.group) == 0); poll_events(&f); assert(!peer(&f, 0) && !peer(&f, 1)); - while (standby_get_sleep_tb()) uasync_poll(f.ua, 100); + /* Остаток SLEEP может обнулиться раньше доставки фазового callback. */ + while (!standby_get_active_remaining_tb()) uasync_poll(f.ua, 100); poll_events(&f); assert(peer(&f, 0) && peer(&f, 1)); assert(standby_set_enabled(f.inst, 0) == 0); destroy(&f);