Added CMake Install.

This commit is contained in:
Maurice Grönwoldt 2023-09-02 14:17:56 +02:00
commit 4367534a33
13 changed files with 68 additions and 18 deletions

View file

@ -30,6 +30,6 @@ bool EPollManager::UpdateEvents(int sock, uint32_t eventType) const {
}
int EPollManager::Wait(int maxEvents, epoll_event *events) const {
return epoll_wait(m_EpollID, events, maxEvents, 10);
return epoll_wait(m_EpollID, events, maxEvents, -1);
}
} // namespace VWeb

View file

@ -45,8 +45,8 @@ SessionManager::SessionManager() {
m_Counter = -1;
}
m_Counter++;
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
});
}
SessionManager::~SessionManager() {
@ -106,7 +106,7 @@ PreMiddleWareReturn CookieManager::PreHandle(Request &request) {
auto &cookies = request.CookieData;
if (cookieHeaders.Size() > 0) {
auto &values = cookieHeaders.Values();
for (auto &rawCookie : cookieHeaders.Values()) {
for (auto &rawCookie : values) {
auto splitCookies = String::Split(rawCookie, ";");
for (auto &cookie : splitCookies) {
auto split = String::Split(cookie, "=");

View file

@ -8,7 +8,7 @@ Server::Server() {
m_ServerConfig->EPoll = CreateRef<EPollManager>();
m_ServerConfig->Socket = CreateRef<SocketManager>(m_ServerConfig);
m_RequestHandler = CreateRef<RequestHandler>(m_ServerConfig->Socket);
auto& middleWare = m_RequestHandler->Middleware();
auto &middleWare = m_RequestHandler->Middleware();
middleWare->Create<CookieManager>();
middleWare->Create<SessionManager>();
middleWare->Create<AuthWare>();

View file

@ -1,8 +1,9 @@
#include <VWeb.h>
#include <thread>
#include <utility>
namespace VWeb {
ThreadPool::ThreadPool(const std::string &name) : m_Name(name) {}
ThreadPool::ThreadPool(std::string name) : m_Name(std::move(name)) {}
void ThreadPool::Create() {
if (m_IsCreated)
return;
@ -10,9 +11,10 @@ void ThreadPool::Create() {
m_IsCreated = true;
m_Queue.Open();
for (int i = 0; i < m_ThreadCount; ++i) {
m_Threads.push_back(std::thread(&ThreadPool::Execute, this));
};
printf("[ThreadPool] >> Created %d Threads for Pool \"%s\"\n", m_ThreadCount, m_Name.c_str());
m_Threads.emplace_back(&ThreadPool::Execute, this);
}
printf("[ThreadPool] >> Created %d Threads for Pool \"%s\"\n", m_ThreadCount,
m_Name.c_str());
}
void ThreadPool::Stop() {
m_IsDone = true;