summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorLeorize <leorize+oss@disroot.org>2020-06-03 13:43:17 -0500
committerAndreas Rumpf <rumpf_a@web.de>2020-06-06 21:11:53 +0200
commit78982b52f035904de0ba2b90f6e4cb43fb76e300 (patch)
tree1adc5bfd8e87858be4be5fecd93436e570ad63ae /lib
parent19ccce2617116270c5a83324f5f442fa7d239ee8 (diff)
downloadNim-78982b52f035904de0ba2b90f6e4cb43fb76e300.tar.gz
net: don't clear error queue unless shutdown() will be performed
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/net.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/net.nim b/lib/pure/net.nim
index f7aacfb0c..1442e8544 100644
--- a/lib/pure/net.nim
+++ b/lib/pure/net.nim
@@ -1006,7 +1006,6 @@ proc close*(socket: Socket) =
   try:
     when defineSsl:
       if socket.isSsl and socket.sslHandle != nil:
-        ErrClearError()
         # Don't call SSL_shutdown if the connection has not been fully
         # established, see:
         # https://github.com/openssl/openssl/issues/710#issuecomment-253897666
@@ -1015,6 +1014,7 @@ proc close*(socket: Socket) =
           # it is valid, under the TLS standard, to perform a unidirectional
           # shutdown i.e not wait for the peers "close notify" alert with a second
           # call to SSL_shutdown
+          ErrClearError()
           let res = SSL_shutdown(socket.sslHandle)
           if res == 0:
             discard