Keep both test transports owned while checking invite timeout

This commit is contained in:
evgeny committed 2026-10-24 15:41:16 +02:00
1 parent 5e8ff95c99
commit 086eefed55
1 file changed
+6 -1
+6 -1
View File
@@ -30,6 +30,7 @@ struct invite_result {
static uint8_t response[512];
static size_t response_size;
static int hold_requests, requests, fail_request_send, fail_timer, fail_alloc;
static struct NODE_CONN_DIRECT* responder_owner;
static void invite_done(uint64_t node_id, uint64_t group_id, int event, void* arg);
int __real_etcp_send(struct ETCP_CONN*, struct ll_entry*);
@@ -37,6 +38,9 @@ int __wrap_etcp_send(struct ETCP_CONN* conn, struct ll_entry* entry) {
if (entry->len >= 2 && entry->dgram[0] == ETCP_ID_GROUP_INVITE) {
if (entry->dgram[1] == TGI_SUBCMD_INFO_RESP && entry->len <= sizeof(response)) {
response_size = entry->len; memcpy(response, entry->dgram, response_size);
/* Удержать и отвечающий транспорт: INFO_RESP сам не владеет групповой сессией. */
if (!responder_owner && node_conn_direct_open(conn->instance, conn->peer_node_id,
NULL, NULL, &responder_owner, NULL) == NCD_ERR) return -1;
}
if (entry->dgram[1] == TGI_SUBCMD_INFO_REQ && hold_requests) {
requests++;
@@ -243,7 +247,7 @@ int main(void) {
deadline = get_time_tb() + 30000;
while (!reply.calls && get_time_tb() < deadline) uasync_poll(ua, 20);
REQUIRE(reply.calls == 1 && reply.event == TGI_EVENT_TIMEOUT && !a->group_invites);
REQUIRE(node_conn_direct_get_conn(owner_handle) == conn && !conn->close_requested);
REQUIRE(node_conn_direct_get_conn(owner_handle) == conn && conn->links_up && !conn->close_requested);
/* DOWN завершает запрос немедленно; повторное UP не вызывает второй callback. */
REQUIRE(begin_wait(a, gid, &node, &reply) == 0);
@@ -271,6 +275,7 @@ int main(void) {
cleanup:
fail_alloc = fail_timer = fail_request_send = 0;
if (owner_handle) node_conn_direct_close(owner_handle);
if (responder_owner) node_conn_direct_close(responder_owner);
if (a) utun_instance_destroy(a);
if (b) utun_instance_destroy(b);
/* Дать event loop освободить отменённые таймеры перед проверкой ресурсов. */