refactor client disconnect, client interation

anywhere a client is disconnected, TNetwork::Disconnect is called now.
Nothing else is valid.
ForEachClientWeak() was fully removed.
This commit is contained in:
Lion Kortlepel
2024-01-11 14:09:50 +01:00
parent aa29d04b60
commit 130e1acdb3
10 changed files with 79 additions and 106 deletions
+5 -1
View File
@@ -44,7 +44,6 @@ public:
void SetIdentifier(const std::string& key, const std::string& value);
std::string GetCarData(int Ident);
std::string GetCarPositionRaw(int Ident);
void Disconnect(std::string_view Reason);
bool IsDisconnected() const { return !TCPSocket->is_open(); }
// locks
void DeleteCar(int Ident);
@@ -75,7 +74,12 @@ public:
Sync<std::queue<std::vector<uint8_t>>> MissedPacketsQueue;
Sync<std::chrono::time_point<std::chrono::high_resolution_clock>> LastPingTime;
friend class TNetwork;
private:
/// ONLY call after the client has been cleaned up, all cars deleted, etc.
void CloseSockets(std::string_view Reason);
void InsertVehicle(int ID, const std::string& Data);
TServer& mServer;