Fix disconnect
This commit is contained in:
@@ -3908,12 +3908,26 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
|||||||
{
|
{
|
||||||
// Track disconnection in Redis
|
// Track disconnection in Redis
|
||||||
_ = TrackPlayerDisconnectedAsync(session);
|
_ = TrackPlayerDisconnectedAsync(session);
|
||||||
|
|
||||||
if (session.CurrentDungeonId.HasValue)
|
if (session.CurrentDungeonId.HasValue)
|
||||||
{
|
{
|
||||||
_ = RemoveFromDungeonAsync(session, false, CancellationToken.None);
|
// Delay removal from dungeon by 25 seconds to allow for reconnection
|
||||||
|
// and to prevent abuse (disconnecting to avoid combat)
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(25));
|
||||||
|
await RemoveFromDungeonAsync(session, false, CancellationToken.None);
|
||||||
|
_log.LogInformation("Player {CharacterName} removed from dungeon after 25s disconnect timeout",
|
||||||
|
session.Character?.Name ?? "Unknown");
|
||||||
|
});
|
||||||
|
|
||||||
|
_log.LogInformation("Dungeon session for {CharacterName} will be removed in 25s after disconnect",
|
||||||
|
session.Character?.Name ?? "Unknown");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_log.LogInformation("Dungeon session cleaned up for connection {Id}", connectionId);
|
||||||
}
|
}
|
||||||
_log.LogInformation("Dungeon session cleaned up for connection {Id}", connectionId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user