asyncdispatch: get rid of erroneous set constructions (#13877)

Ref #13764
This commit is contained in:
alaviss
2020-04-05 06:39:43 +00:00
committed by GitHub
parent a890aa75aa
commit 813ed358bf

View File

@@ -1351,7 +1351,8 @@ else:
flags.toOSFlags())
if res < 0:
let lastError = osLastError()
if lastError.int32 notin {EINTR, EWOULDBLOCK, EAGAIN}:
if lastError.int32 != EINTR and lastError.int32 != EWOULDBLOCK and
lastError.int32 != EAGAIN:
if flags.isDisconnectionError(lastError):
retFuture.complete("")
else:
@@ -1379,7 +1380,8 @@ else:
flags.toOSFlags())
if res < 0:
let lastError = osLastError()
if lastError.int32 notin {EINTR, EWOULDBLOCK, EAGAIN}:
if lastError.int32 != EINTR and lastError.int32 != EWOULDBLOCK and
lastError.int32 != EAGAIN:
if flags.isDisconnectionError(lastError):
retFuture.complete(0)
else:
@@ -1447,7 +1449,8 @@ else:
cast[ptr SockAddr](addr(staddr[0])), stalen)
if res < 0:
let lastError = osLastError()
if lastError.int32 notin {EINTR, EWOULDBLOCK, EAGAIN}:
if lastError.int32 != EINTR and lastError.int32 != EWOULDBLOCK and
lastError.int32 != EAGAIN:
retFuture.fail(newException(OSError, osErrorMsg(lastError)))
else:
result = false # We still want this callback to be called.
@@ -1472,7 +1475,8 @@ else:
saddr, saddrLen)
if res < 0:
let lastError = osLastError()
if lastError.int32 notin {EINTR, EWOULDBLOCK, EAGAIN}:
if lastError.int32 != EINTR and lastError.int32 != EWOULDBLOCK and
lastError.int32 != EAGAIN:
retFuture.fail(newException(OSError, osErrorMsg(lastError)))
else:
result = false
@@ -1493,7 +1497,7 @@ else:
cast[ptr SockAddr](addr(sockAddress)), addr(addrLen))
if client == osInvalidSocket:
let lastError = osLastError()
assert lastError.int32 notin {EWOULDBLOCK, EAGAIN}
assert lastError.int32 != EWOULDBLOCK and lastError.int32 != EAGAIN
if lastError.int32 == EINTR:
return false
else: