From 44d467e9f000b37a8b21c03ff9d16ad9ac39620b Mon Sep 17 00:00:00 2001 From: Nishi Date: Fri, 13 Sep 2024 13:49:53 +0000 Subject: [PATCH] close socket properly git-svn-id: file:///raid/svn-personal/tewi/trunk@15 8739d7e6-ffea-ec47-b151-bdff447c6205 --- Server/server.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Server/server.c b/Server/server.c index 0690d27..120e5a1 100644 --- a/Server/server.c +++ b/Server/server.c @@ -131,13 +131,19 @@ void tw_server_pass(int sock, bool ssl, int port) { SSL_CTX* ctx = NULL; SSL* s = NULL; + bool sslworks = false; if(ssl) { ctx = tw_create_ssl_ctx(port); s = SSL_new(ctx); SSL_set_fd(s, sock); if(SSL_accept(s) <= 0) goto cleanup; + sslworks = true; } cleanup: + if(sslworks){ + SSL_shutdown(s); + } + SSL_free(s); close_socket(sock); #ifdef __MINGW32__ _endthreadex(0); -- 2.43.0