summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorWill Szumski <will@cowboycoders.org>2014-12-17 23:27:11 +0000
committerWill Szumski <will@cowboycoders.org>2014-12-17 23:40:10 +0000
commitff24ca99193190615252aa3d8ec2a56f9aaa3def (patch)
treec830f016ab1f6b17af850075f1fe245c50c2d427 /lib
parentd0ea2bdf5b6b28f5334400aca399e5bb7b2ce50e (diff)
downloadNim-ff24ca99193190615252aa3d8ec2a56f9aaa3def.tar.gz
realised extra parameter was unnecessary
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/net.nim20
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/pure/net.nim b/lib/pure/net.nim
index 30d79ad9a..2b7b96c65 100644
--- a/lib/pure/net.nim
+++ b/lib/pure/net.nim
@@ -430,23 +430,17 @@ proc accept*(server: Socket, client: var Socket,
   var addrDummy = ""
   acceptAddr(server, client, addrDummy, flags)
 
-proc close*(socket: Socket, twoWay = true) =
+proc close*(socket: Socket) =
   ## Closes a socket.
-  ##
-  ## When used with a **SSL** socket, `twoWay` can be set to mandate a two-way
-  ## cryptographically secure shutdown, otherwise, a  "close notify" shutdown
-  ## alert is sent and the underlying socket is closed without waiting for a response.
-  ## This is acceptable under the TLS standard when the underlying connection is not
-  ## going to be use for further communications.
   when defined(ssl):
     if socket.isSSL:
       ErrClearError()
-      var res = SSLShutdown(socket.sslHandle)
-      if res == 0 and twoWay:
-        res = SSLShutdown(socket.sslHandle)
-        if res != 1:
-          socketError(socket, res)
-      elif res == 0:
+      # As we are closing the underlying socket immediately afterwards,
+      # 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 SSLShutdown
+      let res = SSLShutdown(socket.sslHandle)
+      if res == 0:
         discard
       elif res != 1:
         socketError(socket, res)