mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-10 17:56:21 +00:00
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:
committed by
Anonymous275
parent
05c5fb047c
commit
40cae31885
@@ -3,6 +3,9 @@
|
||||
#include "Common.h"
|
||||
#include "TServer.h"
|
||||
#include <optional>
|
||||
|
||||
class TNetwork;
|
||||
|
||||
class TPPSMonitor : public IThreaded {
|
||||
public:
|
||||
explicit TPPSMonitor(TServer& Server);
|
||||
@@ -12,13 +15,13 @@ public:
|
||||
void SetInternalPPS(int NewPPS) { mInternalPPS = NewPPS; }
|
||||
void IncrementInternalPPS() { ++mInternalPPS; }
|
||||
[[nodiscard]] int InternalPPS() const { return mInternalPPS; }
|
||||
void SetTCPServer(TTCPServer& Server) { mTCPServer = std::ref(Server); }
|
||||
void SetNetwork(TNetwork& Server) { mNetwork = std::ref(Server); }
|
||||
|
||||
private:
|
||||
TTCPServer& TCPServer() { return mTCPServer->get(); }
|
||||
|
||||
TNetwork& Network() { return mNetwork->get(); }
|
||||
|
||||
TServer& mServer;
|
||||
std::optional<std::reference_wrapper<TTCPServer>> mTCPServer { std::nullopt };
|
||||
std::optional<std::reference_wrapper<TNetwork>> mNetwork { std::nullopt };
|
||||
bool mShutdown { false };
|
||||
int mInternalPPS { 0 };
|
||||
};
|
||||
Reference in New Issue
Block a user