From 54219245e7602c361ca87a1dfbd150d0fc139990 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 24 Dec 2014 01:52:46 +0000 Subject: [PATCH] Fixes SSL AsyncSocket close problem. Ref #1769. Ref #1759. --- lib/pure/asyncnet.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index fd29e0a22c..fc2722c6fa 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -399,13 +399,13 @@ proc bindAddr*(socket: AsyncSocket, port = Port(0), address = "") {. proc close*(socket: AsyncSocket) = ## Closes the socket. - socket.fd.TAsyncFD.closeSocket() + defer: + socket.fd.TAsyncFD.closeSocket() when defined(ssl): if socket.isSSL: let res = SslShutdown(socket.sslHandle) if res == 0: - if SslShutdown(socket.sslHandle) != 1: - raiseSslError() + discard elif res != 1: raiseSslError() socket.closed = true # TODO: Add extra debugging checks for this.