Skip to content

Commit

Permalink
Handle Windows ERROR_NETNAME_DELETED in accept()
Browse files Browse the repository at this point in the history
This error code indicates that server socket is already
closed, so we raise a TransportClosedError.

Fixes CI failure in Windows.
  • Loading branch information
markspanbroek committed May 19, 2021
1 parent 4dc97c4 commit d1b74b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libp2p/transports/tcptransport.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## This file may not be copied, modified, or distributed except according to
## those terms.

import std/[oids, sequtils, tables]
import std/[oids, sequtils, tables, os]
import chronos, chronicles
import transport,
../errors,
Expand Down Expand Up @@ -201,8 +201,10 @@ method accept*(self: TcpTransport): Future[Session] {.async.} =
except TransportOsError as exc:
# TODO: it doesn't sound like all OS errors
# can be ignored, we should re-raise those
# that can'self.
# that can't.
debug "OS Error", exc = exc.msg
if defined(windows) and exc.code == OSErrorCode(64): # ERROR_NETNAME_DELETED
raise newTransportClosedError(exc)
except TransportTooManyError as exc:
debug "Too many files opened", exc = exc.msg
except TransportUseClosedError as exc:
Expand Down

0 comments on commit d1b74b9

Please sign in to comment.