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 authored and Anonymous275 committed 2021-03-18 23:44:14 +02:00
1 parent 05c5fb047c
commit 40cae31885
15 files changed
+376 -449

No files matched your search

+3 -4
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);
};