summaryrefslogtreecommitdiff
path: root/src/ne_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ne_socket.c')
-rw-r--r--src/ne_socket.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ne_socket.c b/src/ne_socket.c
index 879880e..406ed0b 100644
--- a/src/ne_socket.c
+++ b/src/ne_socket.c
@@ -1923,12 +1923,13 @@ int ne_sock_close(ne_socket *sock)
{
int ret;
- /* Per API description - for an SSL connection, simply send the
- * close_notify but do not wait for the peer's response. */
+ /* Complete a bidirectional shutdown for SSL/TLS. */
#if defined(HAVE_OPENSSL)
if (sock->ssl) {
- SSL_shutdown(sock->ssl);
- SSL_free(sock->ssl);
+ if (SSL_shutdown(sock->ssl) == 0) {
+ SSL_shutdown(sock->ssl);
+ }
+ SSL_free(sock->ssl);
}
#elif defined(HAVE_GNUTLS)
if (sock->ssl) {