Browse Source

Log standby retry transitions and await the actual wake phase

master
evgeny 16 hours ago
parent
commit
df346fc097
  1. 9
      src/routing_layer/topo_group_connect.c
  2. 3
      tests/test_group_connect.c

9
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

3
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);

Loading…
Cancel
Save