mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-05-19 16:10:41 +00:00
Fix exception being thrown on disconnect
It could happen that the socket is already closed when getting the address, switched to the cached ip
This commit is contained in:
+1
-1
@@ -661,7 +661,7 @@ void TNetwork::DisconnectClient(const std::weak_ptr<TClient> &c, const std::stri
|
|||||||
void TNetwork::DisconnectClient(TClient &c, const std::string &R)
|
void TNetwork::DisconnectClient(TClient &c, const std::string &R)
|
||||||
{
|
{
|
||||||
if (c.IsDisconnected()) return;
|
if (c.IsDisconnected()) return;
|
||||||
std::string ClientIP = c.GetTCPSock().remote_endpoint().address().to_string();
|
std::string ClientIP = c.GetIdentifiers().at("ip");
|
||||||
mClientMapMutex.lock();
|
mClientMapMutex.lock();
|
||||||
if (mClientMap[ClientIP] > 0) {
|
if (mClientMap[ClientIP] > 0) {
|
||||||
mClientMap[ClientIP]--;
|
mClientMap[ClientIP]--;
|
||||||
|
|||||||
Reference in New Issue
Block a user