etcp_router: round-robin send + контроль заполненности send_q через waiter на send_input_q

This commit is contained in:
evgeny committed 2026-09-04 19:30:08 +03:00
1 parent 1a88ea88a8
commit 5b8c725c01
5 files changed
+208 -183

No files matched your search

+6 -4
View File
@@ -573,12 +573,12 @@ static int test_send_q(void) {
int ret = etcp_router_conn_send(c, data, sizeof(data));
if (ret != 0) FAIL("conn_send should return 0 (queued in send_q)");
if (c->send_blocked == 0) FAIL("send_blocked not set");
if (c->send_resume_timer == NULL) FAIL("send_resume_timer not set");
if (c->watchdog_timer == NULL) FAIL("watchdog_timer not set");
if (queue_entry_count(c->send_q) != 1) FAIL("send_q count != 1");
if (c->tx_seq != ROUTER_MAX_INFLIGHT) FAIL("tx_seq advanced while queued");
// Cancel timers manually
if (c->send_resume_timer) { uasync_cancel_timeout(ua, c->send_resume_timer); c->send_resume_timer = NULL; }
if (c->watchdog_timer) { uasync_cancel_timeout(ua, c->watchdog_timer); c->watchdog_timer = NULL; }
etcp_router_conn_close(c);
TEARDOWN();
@@ -633,7 +633,7 @@ static int test_timestamp(void) {
}
static int test_conn_send_no_bgp(void) {
TEST("conn_send — no BGP returns error");
TEST("conn_send — no BGP buffers with no_route (lossless)");
struct UASYNC* ua; struct UTUN_INSTANCE inst; etcp_recv_fn recv_cb;
SETUP();
struct ETCP_ROUTER_CONN* c = etcp_router_conn_get(&inst, TOPO_GROUP_UTUN, TEST_REMOTE_NODE, TEST_SVC_ID);
@@ -641,7 +641,9 @@ static int test_conn_send_no_bgp(void) {
uint8_t data[4] = { 1, 2, 3, 4 };
int ret = etcp_router_conn_send(c, data, sizeof(data));
if (ret == 0) FAIL("conn_send should fail without BGP");
if (ret != 0) FAIL("conn_send should buffer (return 0) without BGP");
if (c->no_route == 0) FAIL("no_route not set");
if (queue_entry_count(c->send_q) != 1) FAIL("send_q count != 1");
etcp_router_conn_close(c);
TEARDOWN();