Fix connection refused check.
This commit is contained in:
parent
a4c27806ea
commit
0ea8e65b2c
|
@ -614,13 +614,12 @@ proc testConnectionRefused(address: TransportAddress): Future[bool] {.async.} =
|
||||||
try:
|
try:
|
||||||
var transp = await connect(address)
|
var transp = await connect(address)
|
||||||
except TransportOsError as e:
|
except TransportOsError as e:
|
||||||
|
let ecode = int(e.code)
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
if address.family == AddressFamily.Unix:
|
result = (ecode == ERROR_FILE_NOT_FOUND) or
|
||||||
result = (int(e.code) == ERROR_FILE_NOT_FOUND)
|
(ecode == ERROR_CONNECTION_REFUSED)
|
||||||
else:
|
|
||||||
result = (int(e.code) == ERROR_CONNECTION_REFUSED)
|
|
||||||
else:
|
else:
|
||||||
result = (int(e.code) == ECONNREFUSED)
|
result = (ecode == ECONNREFUSED) or (ecode == ENOENT)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
const
|
const
|
||||||
|
|
Loading…
Reference in New Issue