net: remove more erroneous set constructions (#14252) [backport]

Refs #13764
This commit is contained in:
alaviss 2020-05-07 11:37:54 +00:00 • committed by GitHub
commit 1a1e9986a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,11 +180,16 @@ proc isDisconnectionError*(flags: set[SocketFlag],
## if flags contains ``SafeDisconn``.
when useWinVersion:
SocketFlag.SafeDisconn in flags and
lastError.int32 in {WSAECONNRESET, WSAECONNABORTED, WSAENETRESET,
WSAEDISCON, ERROR_NETNAME_DELETED}
(lastError.int32 == WSAECONNRESET or
lastError.int32 == WSAECONNABORTED or
lastError.int32 == WSAENETRESET or
lastError.int32 == WSAEDISCON or
lastError.int32 == ERROR_NETNAME_DELETED)
else:
SocketFlag.SafeDisconn in flags and
lastError.int32 in {ECONNRESET, EPIPE, ENETRESET}
(lastError.int32 == ECONNRESET or
lastError.int32 == EPIPE or
lastError.int32 == ENETRESET)
proc toOSFlags*(socketFlags: set[SocketFlag]): cint =
## Converts the flags into the underlying OS representation.