Reproduce NCD teardown during synchronous CLOSE queue notification

This commit is contained in:
evgeny committed 2026-10-24 20:15:30 +02:00
1 parent 2a7266e17f
commit 1f6f815917
1 file changed
+12 -1
+12 -1
View File
@@ -334,6 +334,17 @@ static void snapshot_replaced(void) {
node_conn_direct_force_close(handle); teardown();
}
static void close_during_send(struct ll_queue* queue, void* arg) { (void)queue; etcp_connection_close(arg); }
static void synchronous_close(void) {
setup(); struct ETCP_CONN* conn = connection(1); struct NODE_CONN_DIRECT* handle = NULL;
CHECK(node_conn_direct_open(inst, 42, NULL, NULL, &handle, NULL) == NCD_REUSED);
queue_set_callback(conn->send_input_q, close_during_send, conn);
node_conn_direct_close(handle);
uasync_drain_immediate(ua); CHECK(!inst->ncd_registry && !inst->connections->count);
teardown();
}
int main(int argc, char** argv) {
debug_config_init(); debug_set_level(DEBUG_LEVEL_WARN); debug_set_category_level(DEBUG_CATEGORY_DEBUG, DEBUG_LEVEL_INFO);
if (getenv("UTUN_TEST_DEBUG")) debug_set_category_level(DEBUG_CATEGORY_ETCP, DEBUG_LEVEL_DEBUG);
@@ -343,7 +354,7 @@ int main(int argc, char** argv) {
{"fin_wait", fin_wait_failure}, {"nested", nested_events}, {"control", control_length},
{"new", new_transport_failures}, {"policy", candidate_policy}, {"capacity", socket_capacity},
{"cancel", open_cancelled}, {"remove", nested_remove}, {"ipv6", ipv6_candidates},
{"reality", missing_reality}, {"snapshot", snapshot_replaced}
{"reality", missing_reality}, {"snapshot", snapshot_replaced}, {"send_close", synchronous_close}
};
unsigned selected = 0;
for (unsigned i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {