From d3bc77922b4bc6708841099900733cd693778a91 Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 22 Oct 2026 20:55:25 +0200 Subject: [PATCH] Initialize replication router queues before waiting for room --- src/media_delivery/media_delivery.c | 5 ++++- tests/Makefile.am | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/media_delivery/media_delivery.c b/src/media_delivery/media_delivery.c index 83dbdc9e..3a37e895 100644 --- a/src/media_delivery/media_delivery.c +++ b/src/media_delivery/media_delivery.c @@ -474,7 +474,7 @@ failed: } /* Watchdog и waiter только планируют pump; это безопасно при синхронном callback очереди. */ -static void md_repl_ready(void* arg) { md_repl_schedule(arg); } +static void md_repl_ready(struct ll_queue* queue, void* arg) { (void)queue; md_repl_schedule(arg); } static void md_repl_pump(void* arg) { struct media_super_peer* peer = arg; @@ -482,6 +482,9 @@ static void md_repl_pump(void* arg) { peer->pump = NULL; if (!md->initialized || md_group_role(md, peer->group_id, md->self_node_id) != 1 || md_group_role(md, peer->group_id, peer->peer_node_id) != 1) return; + if (!etcp_router_conn_get(md->inst, peer->group_id, peer->peer_node_id, ETCP_RT_ID_MEDIA_DELIVERY)) { + DEBUG_ERROR(DEBUG_CATEGORY_MEDIA, "%s: replication router channel allocation failed", MD_ID); return; + } etcp_router_cancel_send_ready(md->inst, peer->group_id, peer->peer_node_id, ETCP_RT_ID_MEDIA_DELIVERY, &peer->waiter); /* Максимум три пакета за вызов: ответ, свой запрос и подсказка. */ for (int budget = 0; budget < 3; budget++) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 10d52628..ace2b5d1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -905,7 +905,8 @@ check_PROGRAMS += test_media_replication test_media_replication_SOURCES = test_media_replication.c media_delivery_fixture.h test_media_replication_CFLAGS = $(test_media_delivery_download_CFLAGS) test_media_replication_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS) -test_media_replication_LDFLAGS = -Wl,--wrap=etcp_route_send -Wl,--wrap=RAND_bytes +test_media_replication_LDFLAGS = -Wl,--wrap=etcp_route_send -Wl,--wrap=RAND_bytes \ + -Wl,--wrap=conn_mgr_open -Wl,--wrap=conn_mgr_close if OS_LINUX check_PROGRAMS += test_media_blocks