1
0
Fork 0
forked from lthn/blockchain

initializes oatpp environment in daemon and removes redundant initialization in ApiServer

This commit is contained in:
snider 2025-10-16 18:33:06 +01:00
parent 09c987581b
commit bfa73fd70f
2 changed files with 2 additions and 3 deletions

View file

@ -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();
}
}

View file

@ -470,6 +470,7 @@ int main(int argc, char* argv[])
}
std::unique_ptr<ApiServer> api_server;
oatpp::base::Environment::init();
api_server = std::make_unique<ApiServer>(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.");
//