Core/Maps: Fixes player not being removed from map/server when they close the client without using logout/exitgame
This commit is contained in:
@@ -87,7 +87,6 @@ namespace System.Collections.Generic
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool val = _interalStorage[key].Remove(value);
|
bool val = _interalStorage[key].Remove(value);
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ namespace Game.Networking
|
|||||||
long _LastPingTime;
|
long _LastPingTime;
|
||||||
uint _OverSpeedPings;
|
uint _OverSpeedPings;
|
||||||
|
|
||||||
|
object _worldSessionLock = new object();
|
||||||
WorldSession _worldSession;
|
WorldSession _worldSession;
|
||||||
|
|
||||||
ZLib.z_stream _compressionStream;
|
ZLib.z_stream _compressionStream;
|
||||||
@@ -324,6 +325,8 @@ namespace Game.Networking
|
|||||||
HandleEnterEncryptedModeAck();
|
HandleEnterEncryptedModeAck();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
lock (_worldSessionLock)
|
||||||
|
{
|
||||||
if (_worldSession == null)
|
if (_worldSession == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Network, $"ProcessIncoming: Client not authed opcode = {opcode}");
|
Log.outError(LogFilter.Network, $"ProcessIncoming: Client not authed opcode = {opcode}");
|
||||||
@@ -341,6 +344,7 @@ namespace Game.Networking
|
|||||||
|
|
||||||
// Copy the packet to the heap before enqueuing
|
// Copy the packet to the heap before enqueuing
|
||||||
_worldSession.QueuePacket(packet);
|
_worldSession.QueuePacket(packet);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,6 +402,7 @@ namespace Game.Networking
|
|||||||
|
|
||||||
public void SetWorldSession(WorldSession session)
|
public void SetWorldSession(WorldSession session)
|
||||||
{
|
{
|
||||||
|
lock (_worldSessionLock)
|
||||||
_worldSession = session;
|
_worldSession = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,6 +441,16 @@ namespace Game.Networking
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnClose()
|
||||||
|
{
|
||||||
|
lock (_worldSessionLock)
|
||||||
|
{
|
||||||
|
_worldSession.Dispose();
|
||||||
|
_worldSession = null;
|
||||||
|
}
|
||||||
|
base.OnClose();
|
||||||
|
}
|
||||||
|
|
||||||
void HandleSendAuthSession()
|
void HandleSendAuthSession()
|
||||||
{
|
{
|
||||||
AuthChallenge challenge = new AuthChallenge();
|
AuthChallenge challenge = new AuthChallenge();
|
||||||
@@ -780,6 +795,8 @@ namespace Game.Networking
|
|||||||
|
|
||||||
uint maxAllowed = WorldConfig.GetUIntValue(WorldCfg.MaxOverspeedPings);
|
uint maxAllowed = WorldConfig.GetUIntValue(WorldCfg.MaxOverspeedPings);
|
||||||
if (maxAllowed != 0 && _OverSpeedPings > maxAllowed)
|
if (maxAllowed != 0 && _OverSpeedPings > maxAllowed)
|
||||||
|
{
|
||||||
|
lock (_worldSessionLock)
|
||||||
{
|
{
|
||||||
if (_worldSession != null && !_worldSession.HasPermission(RBACPermissions.SkipCheckOverspeedPing))
|
if (_worldSession != null && !_worldSession.HasPermission(RBACPermissions.SkipCheckOverspeedPing))
|
||||||
{
|
{
|
||||||
@@ -788,10 +805,13 @@ namespace Game.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_OverSpeedPings = 0;
|
_OverSpeedPings = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock (_worldSessionLock)
|
||||||
|
{
|
||||||
if (_worldSession != null)
|
if (_worldSession != null)
|
||||||
{
|
{
|
||||||
_worldSession.SetLatency(ping.Latency);
|
_worldSession.SetLatency(ping.Latency);
|
||||||
@@ -802,6 +822,7 @@ namespace Game.Networking
|
|||||||
Log.outError(LogFilter.Network, "WorldSocket:HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = {0}", GetRemoteIpAddress());
|
Log.outError(LogFilter.Network, "WorldSocket:HandlePing: peer sent CMSG_PING, but is not authenticated or got recently kicked, address = {0}", GetRemoteIpAddress());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SendPacket(new Pong(ping.Serial));
|
SendPacket(new Pong(ping.Serial));
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ namespace Game
|
|||||||
|
|
||||||
public void LogoutPlayer(bool save)
|
public void LogoutPlayer(bool save)
|
||||||
{
|
{
|
||||||
|
if (m_playerLogout)
|
||||||
|
return;
|
||||||
|
|
||||||
// finish pending transfers before starting the logout
|
// finish pending transfers before starting the logout
|
||||||
while (_player && _player.IsBeingTeleportedFar())
|
while (_player && _player.IsBeingTeleportedFar())
|
||||||
HandleMoveWorldportAck();
|
HandleMoveWorldportAck();
|
||||||
|
|||||||
Reference in New Issue
Block a user