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
commit 813ed358bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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