From: Nishi Date: Fri, 13 Sep 2024 13:49:53 +0000 (+0000) Subject: close socket properly X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=44d467e9f000b37a8b21c03ff9d16ad9ac39620b;p=tewi.git close socket properly git-svn-id: file:///raid/svn-personal/tewi/trunk@15 8739d7e6-ffea-ec47-b151-bdff447c6205 --- 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);