Merge TUDPServer and TTCPServer into TNetwork

this gets rid of a bunch of unclear cases which I mistakenly created
while refactoring for this rewrite. One example is having to call into
TTCPServer to do UDP sending in some cases.
This commit is contained in:
Lion Kortlepel
2021-03-08 23:45:25 +01:00
committed by Anonymous275
parent 05c5fb047c
commit 40cae31885
15 changed files with 378 additions and 451 deletions

View File

@@ -1,6 +1,6 @@
#include "TPPSMonitor.h"
#include "Client.h"
#include "TTCPServer.h"
#include "TNetwork.h"
TPPSMonitor::TPPSMonitor(TServer& Server)
: mServer(Server) {
@@ -16,7 +16,7 @@ TPPSMonitor::TPPSMonitor(TServer& Server)
Start();
}
void TPPSMonitor::operator()() {
while (!mTCPServer) {
while (!mNetwork) {
// hard spi
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
@@ -46,7 +46,7 @@ void TPPSMonitor::operator()() {
return true;
});
for (auto& ClientToKick : TimedOutClients) {
TCPServer().ClientKick(*ClientToKick, "Timeout (no ping for >10 seconds)");
Network().ClientKick(*ClientToKick, "Timeout (no ping for >10 seconds)");
}
TimedOutClients.clear();
if (C == 0 || mInternalPPS == 0) {