Fix disconnect

This commit is contained in:
dingo
2026-01-21 08:42:45 -05:00
parent ed6ad4985d
commit ad9d17a43b
+17 -3
View File
@@ -3908,12 +3908,26 @@ public sealed partial class DungeonHandler : IClientMessageHandler
{
// Track disconnection in Redis
_ = TrackPlayerDisconnectedAsync(session);
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>