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

@@ -8,8 +8,7 @@
#include <unordered_set>
class TClient;
class TUDPServer;
class TTCPServer;
class TNetwork;
class TPPSMonitor;
class TServer final {
@@ -25,12 +24,12 @@ public:
void ForEachClient(const std::function<bool(std::weak_ptr<TClient>)>& Fn);
size_t ClientCount() const;
static void GlobalParser(const std::weak_ptr<TClient>& Client, std::string Packet, TPPSMonitor& PPSMonitor, TUDPServer& UDPServer, TTCPServer& TCPServer);
static void GlobalParser(const std::weak_ptr<TClient>& Client, std::string Packet, TPPSMonitor& PPSMonitor, TNetwork& Network);
static void HandleEvent(TClient& c, const std::string& Data);
private:
TClientSet mClients;
mutable RWMutex mClientsMutex;
static void ParseVehicle(TClient& c, const std::string& Pckt, TTCPServer& TCPServer, TUDPServer& UDPServer);
static void ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Network);
static void Apply(TClient& c, int VID, const std::string& pckt);
};