From 48c3e793c0e13f28523f4b36cf60723aada2a373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Wed, 18 Mar 2020 11:20:58 +0100 Subject: [PATCH] Fix the vibe.core.net.1726 test to work consistently on Windows. --- tests/vibe.core.net.1726.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/vibe.core.net.1726.d b/tests/vibe.core.net.1726.d index 394ebc1..6f0838f 100644 --- a/tests/vibe.core.net.1726.d +++ b/tests/vibe.core.net.1726.d @@ -30,7 +30,11 @@ void performTest(bool reverse) auto wt = runTask!TCPConnection((conn) { sleep(reverse ? 100.msecs : 20.msecs); // give the connection time to establish try { - conn.write(buf); + // write enough to let the connection block long enough to let + // the remote end close the connection + // NOTE: on Windows, the first write() can actually complete + // immediately, but the second one blocks + foreach (i; 0 .. 2) conn.write(buf); assert(false, "Expected write() to throw an exception."); } catch (Exception) { write_ex = true;