Skip to content

Commit

Permalink
prevent crash on pending connection when closing socket
Browse files Browse the repository at this point in the history
  • Loading branch information
RadKesvat committed Jun 28, 2023
1 parent 5449113 commit 2c67c59
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/overrides/asyncnet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ proc connect*(socket: AsyncSocket, address: string, port: Port, sni:string = "")
## Returns a `Future` which will complete when the connection succeeds
## or an error occurs.
await connect(socket.fd.AsyncFD, address, port, socket.domain)
if socket.closed:
raise newException(EOFError,
"Socket is closed before full connection establishment")


if socket.isSsl:
when defineSsl:
if sni != "":
Expand Down

0 comments on commit 2c67c59

Please sign in to comment.