From bfa73fd70f6422feb7df0519c7633d6f24b4af6d Mon Sep 17 00:00:00 2001 From: snider Date: Thu, 16 Oct 2025 18:33:06 +0100 Subject: [PATCH] initializes oatpp environment in daemon and removes redundant initialization in ApiServer --- src/api/ApiServer.cpp | 2 -- src/daemon/daemon.cpp | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/ApiServer.cpp b/src/api/ApiServer.cpp index ea17fdeb..53067d99 100644 --- a/src/api/ApiServer.cpp +++ b/src/api/ApiServer.cpp @@ -132,14 +132,12 @@ void ApiServer::run() { } void ApiServer::start() { - oatpp::base::Environment::init(); m_server_thread = std::thread(&ApiServer::run, this); } void ApiServer::stop() { if (m_server) { m_server->stop(); - oatpp::base::Environment::destroy(); } } diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index 07c3a095..5d02fd95 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -470,6 +470,7 @@ int main(int argc, char* argv[]) } std::unique_ptr api_server; + oatpp::base::Environment::init(); api_server = std::make_unique(vm, &ccore, &p2psrv, &rpc_server); api_server->start(); @@ -525,7 +526,7 @@ int main(int argc, char* argv[]) p2psrv.deinit(); // LOG_PRINT_L0("Destroying oatpp environment..."); - // oatpp::base::Environment::destroy(); + oatpp::base::Environment::destroy(); // LOG_PRINT_L0("oatpp environment destroyed."); //