Fixed crash in case of ssl error in SSLShutdown (#6662)
This commit is contained in:
parent
e09b2d898d
commit
d7b96f478b
1 changed files with 5 additions and 2 deletions
|
|
@ -857,13 +857,16 @@ proc close*(socket: Socket) =
|
||||||
# shutdown i.e not wait for the peers "close notify" alert with a second
|
# shutdown i.e not wait for the peers "close notify" alert with a second
|
||||||
# call to SSLShutdown
|
# call to SSLShutdown
|
||||||
let res = SSLShutdown(socket.sslHandle)
|
let res = SSLShutdown(socket.sslHandle)
|
||||||
SSLFree(socket.sslHandle)
|
|
||||||
socket.sslHandle = nil
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
discard
|
discard
|
||||||
elif res != 1:
|
elif res != 1:
|
||||||
socketError(socket, res)
|
socketError(socket, res)
|
||||||
finally:
|
finally:
|
||||||
|
when defineSsl:
|
||||||
|
if socket.isSSL and socket.sslHandle != nil:
|
||||||
|
SSLFree(socket.sslHandle)
|
||||||
|
socket.sslHandle = nil
|
||||||
|
|
||||||
socket.fd.close()
|
socket.fd.close()
|
||||||
|
|
||||||
proc toCInt*(opt: SOBool): cint =
|
proc toCInt*(opt: SOBool): cint =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue