SKALE-4005 check for exit

parent aef2a84f
......@@ -32,6 +32,7 @@
#include "sgxwallet_common.h"
#include "ExitHandler.h"
#include "SGXException.h"
#include "LevelDB.h"
......@@ -172,6 +173,7 @@ int SGXRegistrationServer::initRegistrationServer(bool _autoSign) {
if (!server->StartListening()) {
spdlog::error("Registration server could not start listening on port {}", BASE_PORT + 1);
ExitHandler::exitHandler(SIGTERM, ExitHandler::ec_failure);
exit(-10);
} else {
spdlog::info("Registration server started on port {}", BASE_PORT + 1);
......@@ -180,6 +182,19 @@ int SGXRegistrationServer::initRegistrationServer(bool _autoSign) {
return 0;
}
int SGXRegistrationServer::exitServer() {
spdlog::info("Stoping registration server");
if (!server->StopListening()) {
spdlog::error("Registration server could not be stopped");
exit(-102);
} else {
spdlog::info("Registration server stopped");
}
return 0;
}
shared_ptr<SGXRegistrationServer> SGXRegistrationServer::getServer() {
CHECK_STATE(server);
......
......@@ -62,6 +62,7 @@ public:
static int initRegistrationServer(bool _autoSign = false);
static int exitServer();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment