Skip to content

Commit

Permalink
Fix login denied message on soft link death
Browse files Browse the repository at this point in the history
  • Loading branch information
bm01 committed Nov 7, 2024
1 parent 82099ec commit 26b7592
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions GameServer/packets/Client/168/LoginRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,42 +193,43 @@ public void HandlePacket(GameClient client, GSPacketIn packet)
Log.Error("Error shutting down Client after IsAllowedToConnect failed!", e);
}

// Handle connection
// Handle connection.
EnterLock(userName);

try
{
DbAccount playerAccount;
// Make sure that client won't quit

// Make sure that client won't quit.
lock (client)
{
GameClient.eClientState state = client.ClientState;
if (state != GameClient.eClientState.NotConnected)

if (state is not GameClient.eClientState.NotConnected)
{
Log.DebugFormat("wrong client state on connect {0} {1}", userName, state.ToString());
Log.DebugFormat($"wrong client state on connect {userName} {state}");
return;
}

if (Log.IsInfoEnabled)
Log.Info(string.Format("({0})User {1} logging on! ({2} type:{3} add:{4})", ipAddress, userName, client.Version,
(client.ClientType), client.ClientAddons.ToString("G")));
// check client already connected
Log.Info(string.Format($"({ipAddress})User {userName} logging on! ({client.Version} type:{client.ClientType} add:{client.ClientAddons:G})"));

GameClient otherClient = ClientService.GetClientFromAccountName(userName);

if (otherClient != null)
{
if (otherClient.ClientState == GameClient.eClientState.Connecting)
if (otherClient.ClientState is GameClient.eClientState.Connecting)
{
if (Log.IsInfoEnabled)
Log.Info("User is already connecting, ignored.");

client.Out.SendLoginDenied(eLoginError.AccountAlreadyLoggedIn);
client.IsConnected = false;
return;
} // in login
}

if (otherClient.ClientState == GameClient.eClientState.Linkdead)
// Check link death timer instead of client state to account for soft link deaths.
if ((otherClient.Player?.IsLinkDeathTimerRunning) != true)
{
if (Log.IsInfoEnabled)
Log.Info("User is still being logged out from linkdeath!");
Expand Down

0 comments on commit 26b7592

Please sign in to comment.