diff --git a/include/server.h b/include/server.h index 0db5c0315..16d234043 100644 --- a/include/server.h +++ b/include/server.h @@ -105,7 +105,6 @@ namespace kiwix * @param library The library to serve. */ Server(const ServerConfiguration& configuration); - virtual ~Server(); /** @@ -123,11 +122,17 @@ namespace kiwix */ bool isRunning(); + /** + * Get the port of the server + */ int getPort(); + + /** + * Get the ipAddress of the server + */ std::string getAddress(); protected: - ServerConfiguration m_configuration; std::unique_ptr mp_server; }; } diff --git a/src/server.cpp b/src/server.cpp index abcb9833a..be36f30db 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -42,29 +42,21 @@ ServerConfiguration& ServerConfiguration::setRoot(const std::string& root) } Server::Server(const ServerConfiguration& configuration) : - m_configuration(configuration), - mp_server(nullptr) + mp_server(new InternalServer(configuration)) { } Server::~Server() = default; bool Server::start() { - mp_server.reset(new InternalServer(m_configuration)); return mp_server->start(); } void Server::stop() { - if (mp_server) { - mp_server->stop(); - mp_server.reset(nullptr); - } + mp_server->stop(); } bool Server::isRunning() { - if (!mp_server) { - return false; - } return mp_server->isRunning(); }