From 2a9a92cc34c6e81e428aa0ae1ff423867986d406 Mon Sep 17 00:00:00 2001 From: evgeny Date: Sat, 10 Oct 2026 13:27:27 +0200 Subject: [PATCH] tests: finish wrong-key STCP case when handshake closes --- tests/test_stcp_link.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_stcp_link.c b/tests/test_stcp_link.c index 8f48789d..c5e4d81c 100644 --- a/tests/test_stcp_link.c +++ b/tests/test_stcp_link.c @@ -84,9 +84,15 @@ static int test2_wrong_key(void) { 0, 200, 0, on_cli_ready, &cli_ready, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); TASSERT(sc); - int ticks = 0; - while (ticks < 2000) { uasync_poll(ua, 10); ticks++; } + // Неверный ключ должен завершить handshake закрытием, без создания серверного линка. + struct stcp_conn* conn = stcp_client_get_conn(sc); TASSERT(conn); + uint64_t start = get_time_tb(), deadline = start + 20000; + while (conn->state != STCP_STATE_CLOSED && get_time_tb() < deadline) uasync_poll(ua, 10); + TASSERT(conn->state == STCP_STATE_CLOSED); + TASSERT(!cli_ready); TASSERT(!g_on_srv_link); // should NOT connect with wrong key + DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "STCP wrong-key test: handshake closed without READY/link elapsed_tb=%llu", + (unsigned long long)(get_time_tb() - start)); stcp_client_destroy(sc); stcp_link_server_destroy(ss);