Ensure socket is closed after processing in SSLServer (#804)

This commit is contained in:
Jeremie Rahm 2020-12-18 16:29:36 -08:00 committed by GitHub
parent 78ea786abd
commit d0bd4afb0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6301,8 +6301,9 @@ inline bool SSLServer::process_and_close_socket(socket_t sock) {
}, },
[](SSL * /*ssl*/) { return true; }); [](SSL * /*ssl*/) { return true; });
bool ret = false;
if (ssl) { if (ssl) {
auto ret = detail::process_server_socket_ssl( ret = detail::process_server_socket_ssl(
ssl, sock, keep_alive_max_count_, keep_alive_timeout_sec_, ssl, sock, keep_alive_max_count_, keep_alive_timeout_sec_,
read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, read_timeout_sec_, read_timeout_usec_, write_timeout_sec_,
write_timeout_usec_, write_timeout_usec_,
@ -6316,12 +6317,11 @@ inline bool SSLServer::process_and_close_socket(socket_t sock) {
// the connection appeared to be closed. // the connection appeared to be closed.
const bool shutdown_gracefully = ret; const bool shutdown_gracefully = ret;
detail::ssl_delete(ctx_mutex_, ssl, shutdown_gracefully); detail::ssl_delete(ctx_mutex_, ssl, shutdown_gracefully);
return ret;
} }
detail::shutdown_socket(sock); detail::shutdown_socket(sock);
detail::close_socket(sock); detail::close_socket(sock);
return false; return ret;
} }
// SSL HTTP client implementation // SSL HTTP client implementation