From 42b24d184083f41cb15fd048f03720c48b52454d Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Sat, 19 May 2018 08:13:05 +0000 Subject: [PATCH] Fix: Shut down TLS before closing socket. We should first shut down TLS so we can signal the other end a clean shutdown in contrast to a socket failure. Big thanks to wget(1) to find it. Fantastic tool. --- src/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connection.c b/src/connection.c index 8568cc26..8a6fc20d 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1496,10 +1496,10 @@ void connection_close(connection_t *con) if (!con) return; + tls_unref(con->tls); if (con->sock != -1) /* TODO: do not use magic */ sock_close(con->sock); if (con->ip) free(con->ip); - tls_unref(con->tls); free(con); }