From 4764b5f494fd5c0fe41dbc01779738c450198933 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 11 Mar 2025 13:37:25 +0800 Subject: clang-format --- src/main.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 3288b5c..115ad53 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,42 +1,42 @@ #include "chatServer.hpp" -#include #include "log.hpp" +#include #include static void handleSignal(int sig) { - signal(sig, SIG_DFL); + signal(sig, SIG_DFL); - log(SYS, "Caught signal: {}", sig); + log(SYS, "Caught signal: {}", sig); - switch (sig) { - default: - // quick_exit(less cleanup) if the cleanup took too long - signal(SIGALRM, [](int) { std::quick_exit(1); }); - alarm(5); + switch (sig) { + default: + // quick_exit(less cleanup) if the cleanup took too long + signal(SIGALRM, [](int) { std::quick_exit(1); }); + alarm(5); - std::exit(0); - break; - } + std::exit(0); + break; + } } static void registerSignals() { - signal(SIGINT, handleSignal); - signal(SIGTERM, handleSignal); + signal(SIGINT, handleSignal); + signal(SIGTERM, handleSignal); - // client may not finish reading hence the server will receive SIGPIPE, we don't want that to just crash the server - signal(SIGPIPE, SIG_IGN); + // client may not finish reading hence the server will receive SIGPIPE, we don't want that to just crash the server + signal(SIGPIPE, SIG_IGN); } // TODO: ARGC, ARGV. the CServer ctor should take a port number int main() { - registerSignals(); + registerSignals(); - g_pChatServer = std::make_unique(); - g_pChatServer->start(); + g_pChatServer = std::make_unique(); + g_pChatServer->start(); - // died - g_pChatServer->cleanup(); - g_pChatServer.reset(); + // died + g_pChatServer->cleanup(); + g_pChatServer.reset(); - return 0; + return 0; } -- cgit v1.2.3