splitted Webserv.cpp

This commit is contained in:
LuckyLaszlo
2022-07-29 17:16:26 +02:00
parent e5633a30e4
commit 36868afa30
14 changed files with 446 additions and 448 deletions

29
srcs/webserv/signal.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include "Webserv.hpp"
bool g_run;
int g_last_signal;
void signal_handler(int signum)
{
g_last_signal = signum;
}
void Webserv::_handle_last_signal()
{
if (g_last_signal == SIGPIPE)
{
std::cerr << "SIGPIPE\n";
// if (_actual_client)
// {
// _close_client(_actual_client->fd);
// _actual_client = NULL;
// }
}
else if (g_last_signal == SIGINT)
{
g_run = false;
// maybe a throw here instead of "g_run" ?
}
g_last_signal = 0;
}