[Master] Minor fixes

pull/276/head
Koncord 7 years ago
parent cccbe753d7
commit 838e05521e

@ -58,10 +58,12 @@ void AdminRest::start()
*response << response400; *response << response400;
}; };
httpServer.start(); thr = thread([this](){httpServer.start();});
} }
void AdminRest::stop() void AdminRest::stop()
{ {
httpServer.stop(); httpServer.stop();
if(thr.joinable())
thr.join();
} }

@ -19,6 +19,7 @@ public:
private: private:
HttpsServer httpServer; HttpsServer httpServer;
std::shared_ptr<MasterServer> master; std::shared_ptr<MasterServer> master;
std::thread thr;
}; };

@ -167,7 +167,7 @@ void RestServer::start()
*response << response400; *response << response400;
}; };
httpServer.start(); thr = thread([this](){httpServer.start();});
} }
void RestServer::cacheUpdated() void RestServer::cacheUpdated()
@ -178,4 +178,6 @@ void RestServer::cacheUpdated()
void RestServer::stop() void RestServer::stop()
{ {
httpServer.stop(); httpServer.stop();
if(thr.joinable())
thr.join();
} }

@ -24,6 +24,7 @@ private:
HttpServer httpServer; HttpServer httpServer;
MasterServer::ServerMap *serverMap; MasterServer::ServerMap *serverMap;
bool updatedCache = true; bool updatedCache = true;
std::thread thr;
}; };

@ -67,12 +67,8 @@ int main(int argc, char* argv[])
signal(SIGTERM, onExit); signal(SIGTERM, onExit);
masterServer->Start(); masterServer->Start();
restServer->start();
thread rest_thread([]() { restServer->start();}); restAdminServer->start();
thread restAdmin_thread([]() { restAdminServer->start();});
rest_thread.join();
restAdmin_thread.join();
masterServer->Wait(); masterServer->Wait();
return 0; return 0;

Loading…
Cancel
Save