polished up event loop changes
Some checks failed
Docker Build & Publish / build (push) Failing after 55m49s

This commit is contained in:
Nicholas Orlowsky 2025-02-21 18:24:28 -05:00
parent 058c395095
commit 409024e04a
18 changed files with 354 additions and 428 deletions

View file

@ -1,15 +1,35 @@
#include "../lib/anthracite.hpp"
#include "../lib/backends/file_backend.hpp"
#include "../lib/config/config.hpp"
#include "../lib/log/log.hpp"
#include "../lib/thread_mgr/event_loop.hpp"
#include "signal.h"
#include "string.h"
#include <memory>
using namespace anthracite;
std::shared_ptr<anthracite::thread_mgr::thread_mgr> server = nullptr;
extern "C" void signalHandler(int signum)
{
anthracite::log::warn << "Caught signal SIG" << sigabbrev_np(signum) << ", exiting Anthracite" << std::endl;
if (server != nullptr) {
server->stop();
}
}
int main(int argc, char** argv)
{
backends::file_backend fb("./www");
config::config cfg(5);
cfg.add_http_config(config::http_config(8080));
cfg.add_https_config(config::https_config(8081, "", ""));
anthracite::log::logger.initialize(anthracite::log::LOG_LEVEL_INFO);
anthracite::log::info << "Starting Anthracite, a higher performance web server" << std::endl;
signal(SIGINT, signalHandler);
anthracite_main(fb, cfg);
anthracite::backends::file_backend fb("./www");
anthracite::config::config cfg(5, 10000);
cfg.add_http_config(anthracite::config::http_config(8080));
// cfg.add_https_config(config::https_config(8081, "", ""));
server = std::make_shared<anthracite::thread_mgr::event_loop>(fb, cfg);
server->start();
anthracite::log::info << "Stopping Anthracite, a higher performance web server" << std::endl;
}