VWeb/Includes/Server.h
VersusTuneZ 6aac1c31c7
🐛 fix that request.Body contains not full http request after parsing
This makes possible to parse json or other stuff out of it instead of
seeing the full message that is not needed anyway :)
2024-10-14 19:43:30 +02:00

49 lines
1.2 KiB
C++

#pragma once
#include "EPollManager.h"
#include "SocketManager.h"
#include "Map.h"
#include "Router.h"
#include "RequestHandler.h"
#include "MiddleWareHandler.h"
#include "Route.h"
namespace VWeb {
class Server {
public:
Server();
// Will Load SharedLibs from subdirectory
// This will allow that VWeb will run as Standalone and will load .so files
// without recompiling itself
void LoadSharedLibs();
void Start();
void Join() { m_WorkerThread->join(); }
void Stop() { m_IsExit = true; }
Ref<Router> &GetRouter() { return m_Router; }
Ref<ServerConfig> &GetServerConfig() { return m_ServerConfig; }
Ref<RequestHandler> &GetRequestHandler() { return m_RequestHandler; }
Ref<MiddleWareHandler> &Middleware();
protected:
void Execute();
void OutgoingExecute(epoll_event &event);
void IncomingExecute(epoll_event &event);
void HandleRequestReading(epoll_event &event);
void CreateRequest(int sockID);
protected:
Ref<Router> m_Router;
Ref<ServerConfig> m_ServerConfig;
Ref<RequestHandler> m_RequestHandler;
SafeMap<int, Accept> m_RawRequest{60000};
SafeMap<int, SendData> m_OutRequest{60000};
Ref<std::thread> m_WorkerThread;
std::mutex m_Mutex;
bool m_IsExit{false};
protected:
friend RequestHandler;
};
}