Merge pull request #232 from vibe-d/waitfordataex_fix

Fix waitForDataEx's return value for an open connection and a zero timeout
This commit is contained in:
Sönke Ludwig 2020-10-15 14:03:21 +02:00 committed by GitHub
commit 97fdff2574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);