refactor: remove unused Router references from Client and Server classes

This commit is contained in:
Quinten 2025-10-14 19:02:49 +02:00
parent 3a95041815
commit 68ea191460
4 changed files with 1 additions and 11 deletions

View File

@ -97,8 +97,6 @@ std::vector<uint8_t> Client::getResponse() const
{ {
Log::trace(LOCATION); Log::trace(LOCATION);
const Router &router = server_.getRouter();
static_cast<void>(router); // Suppress unused variable warning
auto response = Router::handleRequest(*httpRequest_); auto response = Router::handleRequest(*httpRequest_);
return response->toBytes(); return response->toBytes();
} }

View File

@ -8,7 +8,6 @@
#include <webserv/http/HttpResponse.hpp> // for HttpResponse #include <webserv/http/HttpResponse.hpp> // for HttpResponse
#include <webserv/server/Server.hpp> #include <webserv/server/Server.hpp>
#include <webserv/socket/ClientSocket.hpp> // for ClientSocket #include <webserv/socket/ClientSocket.hpp> // for ClientSocket
#include <webserv/socket/ClientSocket.hpp>
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <cstdint> // for uint8_t #include <cstdint> // for uint8_t

View File

@ -27,7 +27,7 @@
class Router; class Router;
Server::Server(const ConfigManager &configManager) Server::Server(const ConfigManager &configManager)
: epoll_fd_(epoll_create1(0)), configManager_(configManager), router_() : epoll_fd_(epoll_create1(0)), configManager_(configManager)
{ {
Log::trace(LOCATION); Log::trace(LOCATION);
const auto &serverConfigs = configManager.getServerConfigs(); const auto &serverConfigs = configManager.getServerConfigs();
@ -244,8 +244,3 @@ void Server::run()
} }
} }
} }
const Router &Server::getRouter() const
{
return router_;
}

View File

@ -43,12 +43,10 @@ class Server
ServerSocket &getListener(int fd) const; ServerSocket &getListener(int fd) const;
Client &getClient(int fd) const; Client &getClient(int fd) const;
const Router &getRouter() const;
private: private:
int epoll_fd_; int epoll_fd_;
const ConfigManager &configManager_; const ConfigManager &configManager_;
const Router router_;
std::vector<std::unique_ptr<ServerSocket>> listeners_; std::vector<std::unique_ptr<ServerSocket>> listeners_;
std::set<int> listener_fds_; std::set<int> listener_fds_;
// std::unordered_map<int, std::unique_ptr<Client>> clients_; // std::unordered_map<int, std::unique_ptr<Client>> clients_;