From 091a1dc053fcf5ef0408f61360a7129bedbeb63a Mon Sep 17 00:00:00 2001 From: evgeny Date: Fri, 30 Oct 2026 22:39:37 +0100 Subject: [PATCH] Specify explicit admission policy in existing ETCP constructors --- tests/test_dummynet_channels.c | 2 +- tests/test_etcp_driver.c | 12 ++++++------ tests/test_stream_tx_stats.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_dummynet_channels.c b/tests/test_dummynet_channels.c index 8884f96d..695b3eca 100644 --- a/tests/test_dummynet_channels.c +++ b/tests/test_dummynet_channels.c @@ -257,7 +257,7 @@ static void inline_filter(void) { struct UTUN_INSTANCE* inst = utun_instance_create_from_str(ua, "[global]\nauto_sockets=no\n[ntp]\nenabled=no\n[server:udp]\naddr=127.0.0.1:0\ntype=public\n"); CHECK(inst && inst->etcp_sockets); - struct ETCP_CONN* connection = etcp_connection_create(inst, "inline filter test"); CHECK(connection); + struct ETCP_CONN* connection = etcp_connection_create(inst, "inline filter test", 0); CHECK(connection); struct sockaddr_storage target = {0}; struct sockaddr_in* address = (struct sockaddr_in*)⌖ *address = proxy; address->sin_port = htons(socket_get_bound_port(peers[1])); diff --git a/tests/test_etcp_driver.c b/tests/test_etcp_driver.c index 5ce6cf05..1580254c 100644 --- a/tests/test_etcp_driver.c +++ b/tests/test_etcp_driver.c @@ -97,7 +97,7 @@ static void setup(void) { ep->inst.data_pool = memory_pool_init(PACKET_DATA_SIZE, "driver_payload"); ep->inst.ack_pool = memory_pool_init(sizeof(struct ACK_PACKET), "driver_acks"); assert(ep->inst.connections && ep->inst.pkt_pool && ep->inst.data_pool && ep->inst.ack_pool); - ep->conn = etcp_connection_create(&ep->inst, "dynamic-driver"); assert(ep->conn && !ep->conn->links); + ep->conn = etcp_connection_create(&ep->inst, "dynamic-driver", 0); assert(ep->conn && !ep->conn->links); assert(!etcp_bind(&ep->inst, 253, receive)); } for (int i = 0; i < 2; i++) { @@ -151,12 +151,12 @@ int main(void) { struct packet_link_driver drivers[2] = {api(&pipes[0]), api(&pipes[1])}; drivers[0].direction = PACKET_LINK_OUTGOING; drivers[1].direction = PACKET_LINK_INCOMING; pipes[0].refuse = 1; - assert(!etcp_link_add(endpoints[0].conn, &drivers[0])); + assert(!etcp_link_add(endpoints[0].conn, &drivers[0], 0)); assert(!endpoints[0].conn->links && !pipes[0].bound && !pipes[0].stopped && !pipes[0].destroyed); pipes[0].refuse = 0; struct ETCP_LINK* links[2]; for (int i = 0; i < 2; i++) { - links[i] = etcp_link_add(endpoints[i].conn, &drivers[i]); assert(links[i]); + links[i] = etcp_link_add(endpoints[i].conn, &drivers[i], 0); assert(links[i]); assert(!links[i]->conn && !links[i]->is_tcp && !pipes[i].sent); } struct etcp_link_snapshot snapshots[2]; @@ -177,7 +177,7 @@ int main(void) { assert(snapshots[i].direction == (i ? PACKET_LINK_INCOMING : PACKET_LINK_OUTGOING)); } struct packet_link_driver duplicate = api(&pipes[0]); - assert(!etcp_link_add(endpoints[0].conn, &duplicate) && !pipes[0].stopped); + assert(!etcp_link_add(endpoints[0].conn, &duplicate, 0) && !pipes[0].stopped); for (int i = 0; i < 2; i++) { pipes[i].held = 1; pipes[i].events.state_changed(pipes[i].arg); } unsigned sent = pipes[0].sent + pipes[1].sent; exchange(0); @@ -200,13 +200,13 @@ int main(void) { etcp_add_link_status_cbk(&endpoints[0].inst, close_initial, &closed_in_callback); struct pipe_driver cancelled = {.ua = ua, .held = 1, .peer = &pipes[1]}; struct packet_link_driver cancelled_api = api(&cancelled); - assert(etcp_link_add(endpoints[0].conn, &cancelled_api)); assert(!closed_in_callback); + assert(etcp_link_add(endpoints[0].conn, &cancelled_api, 0)); assert(!closed_in_callback); uasync_drain_immediate(ua); assert(closed_in_callback == 1 && cancelled.destroyed && !cancelled.sent); etcp_remove_link_status_cbk(&endpoints[0].inst, close_initial, &closed_in_callback); /* Независимый второй экземпляр; закрытие первого не закрывает соединение/другой драйвер. */ struct pipe_driver extra = {.ua = ua, .held = 1, .peer = &pipes[1]}; struct packet_link_driver extra_api = api(&extra); - struct ETCP_LINK* extra_link = etcp_link_add(endpoints[0].conn, &extra_api); assert(extra_link); + struct ETCP_LINK* extra_link = etcp_link_add(endpoints[0].conn, &extra_api, 0); assert(extra_link); etcp_link_close(links[0]); assert(pipes[0].stopped && !pipes[0].destroyed && !extra.stopped); assert(endpoints[0].conn->links == extra_link); assert(!strcmp(snapshots[0].protocol, "memory-packet") && snapshots[0].direction == PACKET_LINK_OUTGOING); diff --git a/tests/test_stream_tx_stats.c b/tests/test_stream_tx_stats.c index 4b628f1d..36f33c5d 100644 --- a/tests/test_stream_tx_stats.c +++ b/tests/test_stream_tx_stats.c @@ -32,7 +32,7 @@ int main(void) { test_window(); utun_instance_set_tun_init_enabled(0); struct UASYNC *ua = uasync_create(); CHECK(ua); struct UTUN_INSTANCE *inst = utun_instance_create_from_str(ua, "[global]\nauto_sockets=no\n"); CHECK(inst); - struct ETCP_CONN *a = etcp_connection_create(inst, "stats-a"), *b = etcp_connection_create(inst, "stats-b"); CHECK(a && b); + struct ETCP_CONN *a = etcp_connection_create(inst, "stats-a", 0), *b = etcp_connection_create(inst, "stats-b", 0); CHECK(a && b); queue_set_callback(a->input_send_q, NULL, NULL); queue_set_callback(b->input_wait_ack, NULL, NULL); packet(a, a->input_send_q, 1, 80); packet(b, b->input_wait_ack, 2, 120); a->normalizer->data = memory_pool_alloc(inst->data_pool); CHECK(a->normalizer->data); a->normalizer->data_ptr = 10;