From 821757acef2da048ea1610e9c25cd428f2506e3f Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 4 Nov 2026 09:24:46 +0700 Subject: [PATCH] Control server: the junk-closes test leaves no unread input On Windows, closing a socket with unread input resets the connection, and the reset can discard the reply before the client reads it, so the test failed under load. The request after junk is still covered by the in-memory tests. --- apps/vectorcraft/src/control_server/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/vectorcraft/src/control_server/tests.rs b/apps/vectorcraft/src/control_server/tests.rs index e3d946ef0..aad5d7d08 100644 --- a/apps/vectorcraft/src/control_server/tests.rs +++ b/apps/vectorcraft/src/control_server/tests.rs @@ -334,7 +334,9 @@ fn tcp_connection_is_closed_after_junk() { }); let mut c = TcpStream::connect(addr).unwrap(); c.set_read_timeout(Some(WAIT)).unwrap(); - c.write_all(b"{\"id\":7,\"method\":\"x\"}\nhello\n{\"method\":\"y\"}\n").unwrap(); + // Nothing after the junk line: on Windows, closing a socket with unread input resets the + // connection, and the reset can discard the reply before the client reads it. + c.write_all(b"{\"id\":7,\"method\":\"x\"}\nhello\n").unwrap(); let mut text = String::new(); c.read_to_string(&mut text).unwrap(); // returns at EOF: the server closed the connection server.join().unwrap();