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