asyncnet: don't try to close the socket again [backport] (#15174)
The closed flag isn't a good design by any means, but let's have this working first before I get rid of the flag and potentially create a non-backportable commit.
This commit is contained in:
parent
ce2da87eca
commit
957bf15a08
1 changed files with 20 additions and 17 deletions
|
|
@ -713,8 +713,12 @@ elif defined(nimdoc):
|
||||||
|
|
||||||
proc close*(socket: AsyncSocket) =
|
proc close*(socket: AsyncSocket) =
|
||||||
## Closes the socket.
|
## Closes the socket.
|
||||||
|
if socket.closed: return
|
||||||
|
|
||||||
defer:
|
defer:
|
||||||
socket.fd.AsyncFD.closeSocket()
|
socket.fd.AsyncFD.closeSocket()
|
||||||
|
socket.closed = true # TODO: Add extra debugging checks for this.
|
||||||
|
|
||||||
when defineSsl:
|
when defineSsl:
|
||||||
if socket.isSsl:
|
if socket.isSsl:
|
||||||
let res =
|
let res =
|
||||||
|
|
@ -731,7 +735,6 @@ proc close*(socket: AsyncSocket) =
|
||||||
discard
|
discard
|
||||||
elif res != 1:
|
elif res != 1:
|
||||||
raiseSSLError()
|
raiseSSLError()
|
||||||
socket.closed = true # TODO: Add extra debugging checks for this.
|
|
||||||
|
|
||||||
when defineSsl:
|
when defineSsl:
|
||||||
proc wrapSocket*(ctx: SslContext, socket: AsyncSocket) =
|
proc wrapSocket*(ctx: SslContext, socket: AsyncSocket) =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue