http: Properly stop server on stop server.
This commit is contained in:
parent
429346bb94
commit
287d1967a5
3 changed files with 19 additions and 4 deletions
|
@ -79,7 +79,7 @@ static void RegisterServer(int port) {
|
|||
static void ExecuteServer() {
|
||||
setCurrentThreadName("HTTPServer");
|
||||
|
||||
net::Init();
|
||||
net::AutoInit netInit;
|
||||
auto http = new http::Server(new threading::SameThreadExecutor());
|
||||
|
||||
std::map<std::string, std::string> paths;
|
||||
|
@ -156,7 +156,11 @@ static void ExecuteServer() {
|
|||
}
|
||||
|
||||
if (!http->Listen(g_Config.iRemoteISOPort)) {
|
||||
http->Listen(0);
|
||||
if (!http->Listen(0)) {
|
||||
ERROR_LOG(COMMON, "Unable to listen on any port");
|
||||
UpdateStatus(ServerStatus::STOPPED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateStatus(ServerStatus::RUNNING);
|
||||
|
||||
|
@ -173,7 +177,7 @@ static void ExecuteServer() {
|
|||
}
|
||||
}
|
||||
|
||||
net::Shutdown();
|
||||
http->Stop();
|
||||
|
||||
UpdateStatus(ServerStatus::STOPPED);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue