From 497a4ecefb6438c8defe3bafde875f470c37fbe6 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Fri, 5 Feb 2016 13:10:22 +0100 Subject: [PATCH] Some fixes. --- src/Components/Modules/Console.cpp | 22 ++++++++++++---------- src/Components/Modules/Dedicated.cpp | 3 +++ src/Components/Modules/Node.cpp | 17 ++++++++++++----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/Components/Modules/Console.cpp b/src/Components/Modules/Console.cpp index 0e111acd..4d203095 100644 --- a/src/Components/Modules/Console.cpp +++ b/src/Components/Modules/Console.cpp @@ -353,17 +353,19 @@ namespace Components wattron(Console::OutputWindow, COLOR_PAIR(9)); - int currentTime = static_cast(GetTickCount64()); // Make our compiler happy +// int currentTime = static_cast(GetTickCount64()); // Make our compiler happy +// +// if (!Console::HasConsole) +// { +// Console::RefreshOutput(); +// } +// else if ((currentTime - Console::LastRefresh) > 100) +// { +// Console::RefreshOutput(); +// Console::LastRefresh = currentTime; +// } - if (!Console::HasConsole) - { - Console::RefreshOutput(); - } - else if ((currentTime - Console::LastRefresh) > 100) - { - Console::RefreshOutput(); - Console::LastRefresh = currentTime; - } + Console::RefreshOutput(); } Console::Console() diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index 28ae9a5a..d388df9b 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -231,6 +231,8 @@ namespace Components // Post initialization point Utils::Hook(0x60BFBF, Dedicated::PostInitializationStub, HOOK_JUMP).Install()->Quick(); +#ifdef USE_LEGACY_SERVER_LIST + // Heartbeats Dedicated::OnFrame([] () { @@ -242,6 +244,7 @@ namespace Components Dedicated::Heartbeat(); } }); +#endif } } } diff --git a/src/Components/Modules/Node.cpp b/src/Components/Modules/Node.cpp index d97b824e..0bd298f5 100644 --- a/src/Components/Modules/Node.cpp +++ b/src/Components/Modules/Node.cpp @@ -202,12 +202,15 @@ namespace Components { if (dedi.address == address) { - dedi.state = (info.Get("challenge") == dedi.challenge ? Node::STATE_VALID : Node::STATE_INVALID); - dedi.lastTime = Game::Com_Milliseconds(); - - if (dedi.state == Node::STATE_VALID) + if (dedi.state == Node::STATE_QUERYING) { - Logger::Print("Validated dedi %s\n", address.GetString()); + dedi.state = (info.Get("challenge") == dedi.challenge ? Node::STATE_VALID : Node::STATE_INVALID); + dedi.lastTime = Game::Com_Milliseconds(); + + if (dedi.state == Node::STATE_VALID) + { + Logger::Print("Validated dedi %s\n", address.GetString()); + } } break; } @@ -415,6 +418,10 @@ namespace Components Node::SendNodeList(address); Node::SendDediList(address); + + // Send our heartbeat as well :P + // Otherwise, if there's only 1 node in the network (us), we might not get listed as dedi + Network::Send(address, "heartbeat\n"); }); }