mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 15:26:59 +00:00
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.
27 lines
694 B
C++
27 lines
694 B
C++
#pragma once
|
|
|
|
#include "Common.h"
|
|
#include "TServer.h"
|
|
#include <optional>
|
|
|
|
class TNetwork;
|
|
|
|
class TPPSMonitor : public IThreaded {
|
|
public:
|
|
explicit TPPSMonitor(TServer& Server);
|
|
|
|
void operator()() override;
|
|
|
|
void SetInternalPPS(int NewPPS) { mInternalPPS = NewPPS; }
|
|
void IncrementInternalPPS() { ++mInternalPPS; }
|
|
[[nodiscard]] int InternalPPS() const { return mInternalPPS; }
|
|
void SetNetwork(TNetwork& Server) { mNetwork = std::ref(Server); }
|
|
|
|
private:
|
|
TNetwork& Network() { return mNetwork->get(); }
|
|
|
|
TServer& mServer;
|
|
std::optional<std::reference_wrapper<TNetwork>> mNetwork { std::nullopt };
|
|
bool mShutdown { false };
|
|
int mInternalPPS { 0 };
|
|
}; |