summary refs log tree commit diff stats
path: root/lib/impure/ssl.nim
diff options
context:
space:
mode:
authordom96 <dominikpicheta@googlemail.com>2010-10-27 19:06:25 +0100
committerdom96 <dominikpicheta@googlemail.com>2010-10-27 19:06:25 +0100
commit8733886e5370e507e4179932b5658be2ee696e0f (patch)
tree9e8f055f0065fb277768ca66a2ce97cb751c4c27 /lib/impure/ssl.nim
parent0879f0b0a7741dc725f1993b4490e00a13a640e0 (diff)
downloadNim-8733886e5370e507e4179932b5658be2ee696e0f.tar.gz
Added a close function to the ssl module.
Diffstat (limited to 'lib/impure/ssl.nim')
-rw-r--r--lib/impure/ssl.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/impure/ssl.nim b/lib/impure/ssl.nim
index e90488a2b..ab53d0538 100644
--- a/lib/impure/ssl.nim
+++ b/lib/impure/ssl.nim
@@ -74,6 +74,12 @@ proc send*(sock: TSecureSocket, data: string) =
   if BIO_write(sock.bio, data, data.len()) <= 0:
     OSError()
 
+proc close*(sock: TSecureSocket) =
+  ## Closes the socket
+  if BIO_free(sock.bio) <= 0:
+    ERR_print_errors_fp(stderr)
+    OSError()
+
 when isMainModule:
   var s: TSecureSocket
   echo connect(s, "smtp.gmail.com", 465)