[Dedicated] Actually fix sv_lanOnly

This commit is contained in:
FutureRave 2022-05-04 00:26:53 +01:00
parent d28dc6ecc4
commit 219a10d6a0
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955

View File

@ -252,9 +252,15 @@ namespace Components
}
void Dedicated::Heartbeat()
{
int masterPort = Dvar::Var("masterPort").get<int>();
const char* masterServerName = Dvar::Var("masterServerName").get<const char*>();
{
// Do not send a heartbeat if sv_lanOnly is set to true
if (Dedicated::SVLanOnly.get<bool>())
{
return;
}
auto masterPort = Dvar::Var("masterPort").get<int>();
const auto* masterServerName = Dvar::Var("masterServerName").get<const char*>();
Network::Address master(Utils::String::VA("%s:%u", masterServerName, masterPort));
@ -386,12 +392,6 @@ namespace Components
{
static Utils::Time::Interval interval;
// Do not send an heartbeat if sv_lanOnly is set to true
if (Dedicated::SVLanOnly.get<bool>())
{
return;
}
if (Dvar::Var("sv_maxclients").get<int>() > 0 && interval.elapsed(2min))
{
interval.update();