From ae6506289a2e12e35f623a989a628cd42677363e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 15 Oct 2020 13:13:15 +0200 Subject: [PATCH] Fix waitForDataEx's return value for an open connection and a zero timeout. IOMode.once causes the read() to return with IOStatus.wouldBlock immediately, which previously resulted in erroneously reporting WaitForDataStatus.noModeData instead of timeout. See vibe-d/vibe.d#2483 --- source/vibe/core/net.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/vibe/core/net.d b/source/vibe/core/net.d index 5a87bda..4741fe2 100644 --- a/source/vibe/core/net.d +++ b/source/vibe/core/net.d @@ -612,7 +612,10 @@ mixin(tracer); asyncAwaitAny!(true, waiter)(timeout); if (!m_context) return WaitForDataStatus.noMoreData; - if (cancelled) return WaitForDataStatus.timeout; + // NOTE: for IOMode.immediate, no actual timeout occurrs, but the read + // fails immediately with wouldBlock + if (cancelled || status == IOStatus.wouldBlock) + return WaitForDataStatus.timeout; logTrace("Socket %s, read %s bytes: %s", m_socket, nbytes, status);