diff options
| -rw-r--r-- | maple/maple.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/maple/maple.cc b/maple/maple.cc index b645dc3..94b1005 100644 --- a/maple/maple.cc +++ b/maple/maple.cc @@ -32,14 +32,17 @@ static int maple_socket; static SSL_CTX *ssl_context; -auto handle_shutdown(int) -> void; - auto main() -> int { sockaddr_in socket_address {}; std::vector<std::string> gemini_files; // Try a graceful shutdown when a SIGINT is detected - signal(SIGINT, handle_shutdown); + signal(SIGINT, [](int signal_){ + std::cout << "shutdown(" << signal_ << ")" << std::endl; + + close(maple_socket); + SSL_CTX_free(ssl_context); + }); // Find and keep track of all Gemini files to serve for (const auto &entry : @@ -210,10 +213,3 @@ auto main() -> int { close(client); } } - -auto handle_shutdown(int signal) -> void { - std::cout << "shutdown(" << signal << ")" << std::endl; - - close(maple_socket); - SSL_CTX_free(ssl_context); -} |