From 8733886e5370e507e4179932b5658be2ee696e0f Mon Sep 17 00:00:00 2001 From: dom96 Date: Wed, 27 Oct 2010 19:06:25 +0100 Subject: Added a close function to the ssl module. --- lib/impure/ssl.nim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/impure/ssl.nim') 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) -- cgit 1.4.1-2-gfad0