Initial commit

This commit is contained in:
2019-06-15 12:00:21 +02:00
commit eda5d9df6b
31 changed files with 1328 additions and 0 deletions

31
src/server/server.cpp Executable file
View File

@@ -0,0 +1,31 @@
#include "../logger.hpp"
#include "configuration.hpp"
#include "server.hpp"
#include <sstream>
#include <stdexcept>
void HttpServer::Execute()
{
while(isOpen)
{
try
{
Connection newConnection = listeningSocket.AcceptNextConnection();
connectionOperator.HandleNewConnection(newConnection);
}
catch (std::runtime_error & e)
{
Logger::GetInstance().Info("Connection dropped on accept");
}
}
}
HttpServer::HttpServer()
: listeningSocket(ServerConfiguration::GetInstance().GetPort()),
connectionOperator(),
isOpen(true)
{
std::stringstream ss;
ss << "Listening on port " << ServerConfiguration::GetInstance().GetPort();
Logger::GetInstance().Info(ss.str());
}