mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-12 20:54:35 +01:00
prevent a race condition in duplicated session
This commit is contained in:
@@ -45,6 +45,7 @@ namespace AscNet.GameServer.Handlers
|
||||
[RequestPacketHandler("LoginRequest")]
|
||||
public static void LoginRequestHandler(Session session, Packet.Request packet)
|
||||
{
|
||||
start:
|
||||
LoginRequest request = MessagePackSerializer.Deserialize<LoginRequest>(packet.Content);
|
||||
Player? player = Player.FromToken(request.Token);
|
||||
|
||||
@@ -63,6 +64,9 @@ namespace AscNet.GameServer.Handlers
|
||||
// GateServerForceLogoutByAnotherLogin
|
||||
previousSession.SendPush(new ForceLogoutNotify() { Code = 1018 });
|
||||
previousSession.DisconnectProtocol();
|
||||
|
||||
// Player data will be outdated without refetching it after disconnecting the previous session.
|
||||
goto start;
|
||||
}
|
||||
|
||||
session.player = player;
|
||||
|
||||
Reference in New Issue
Block a user