Merge pull request #728 from diamante0018/develop

[Download]: Add flag to disable web server
This commit is contained in:
Edo 2023-01-20 10:10:59 +00:00 committed by GitHub
commit 01d31940a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -654,29 +654,32 @@ namespace Components
if (Dedicated::IsEnabled())
{
mg_mgr_init(&Mgr);
Network::OnStart([]
if (!Flags::HasFlag("disable-mongoose"))
{
const auto* nc = mg_http_listen(&Mgr, Utils::String::VA(":%hu", Network::GetPort()), &EventHandler, &Mgr);
if (!nc)
{
Logger::PrintError(Game::CON_CHANNEL_ERROR, "Failed to bind TCP socket, mod download won't work!\n");
Terminate = true;
}
});
mg_mgr_init(&Mgr);
ServerRunning = true;
Terminate = false;
ServerThread = Utils::Thread::CreateNamedThread("Mongoose", []
{
Com_InitThreadData();
while (!Terminate)
Network::OnStart([]
{
mg_mgr_poll(&Mgr, 1000);
}
});
const auto* nc = mg_http_listen(&Mgr, Utils::String::VA(":%hu", Network::GetPort()), &EventHandler, &Mgr);
if (!nc)
{
Logger::PrintError(Game::CON_CHANNEL_ERROR, "Failed to bind TCP socket, mod download won't work!\n");
Terminate = true;
}
});
ServerRunning = true;
Terminate = false;
ServerThread = Utils::Thread::CreateNamedThread("Mongoose", []
{
Com_InitThreadData();
while (!Terminate)
{
mg_mgr_poll(&Mgr, 1000);
}
});
}
}
else
{