Poll diagnostic mesh tail after the original loop stops

This commit is contained in:
evgeny committed 2026-10-26 14:57:41 +01:00
1 parent c2908a6c58
commit d943c0ddca
1 file changed
+4 -3
+4 -3
View File
@@ -160,7 +160,7 @@ static void mesh_snapshot(struct mesh_ctx* t, const char* reason) {
}
}
static void mesh_tail_stop(void* arg) { uasync_stop(arg); }
static void mesh_tail_stop(void* arg) { *(int*)arg = 1; }
static int G_PASSED = 0, G_FAILED = 0, G_TOTAL = 0;
#define TEST(n) do { G_TOTAL++; printf(" %-58s", n); fflush(stdout); } while(0)
@@ -536,9 +536,10 @@ int main(int argc, char** argv) {
/* Диагностический хвост не меняет сохранённый результат исходной проверки. */
if (getenv("UTUN_TEST_MESH_TAIL")) {
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "mesh observe tail=500ms original_ok=%d original_dupC=%u", ok, dup_c);
void* tail = uasync_set_timeout(ua, 5000, ua, mesh_tail_stop, "mesh_diagnostic_tail");
int finished = 0;
void* tail = uasync_set_timeout(ua, 5000, &finished, mesh_tail_stop, "mesh_diagnostic_tail");
if (!tail) { DEBUG_ERROR(DEBUG_CATEGORY_DEBUG, "mesh: tail timer allocation failed"); abort(); }
uasync_mainloop(ua);
while (!finished) uasync_poll(ua, 100);
mesh_snapshot(&t, "after_diagnostic_tail");
}