Fix the vibe.core.net.1726 test to work consistently on Windows.

This commit is contained in:
Sönke Ludwig 2020-03-18 11:20:58 +01:00
parent 73367273b5
commit 48c3e793c0

View file

@ -30,7 +30,11 @@ void performTest(bool reverse)
auto wt = runTask!TCPConnection((conn) { auto wt = runTask!TCPConnection((conn) {
sleep(reverse ? 100.msecs : 20.msecs); // give the connection time to establish sleep(reverse ? 100.msecs : 20.msecs); // give the connection time to establish
try { 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."); assert(false, "Expected write() to throw an exception.");
} catch (Exception) { } catch (Exception) {
write_ex = true; write_ex = true;