Skip to content

Commit

Permalink
Fix: Avoid the logout timer trying to acquire the lock twice
Browse files Browse the repository at this point in the history
  • Loading branch information
fearnlj01 authored and da3dsoul committed Nov 13, 2024
1 parent 4313d61 commit 51e529b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,10 @@ private void LogoutTimerElapsed(object? sender, ElapsedEventArgs e)
try
{
if (!_isLoggedOn) return;
_socketHandlerLock.Wait();
try
{
if (_socketHandler == null || _socketHandler.IsLocked || !_socketHandler.IsConnected) return;
if (IsBanned || BackoffSecs.HasValue) return;
if (_socketHandler == null || _socketHandler.IsLocked || !_socketHandler.IsConnected) return;
if (IsBanned || BackoffSecs.HasValue) return;

ForceLogout();
}
finally
{
_socketHandlerLock.Release();
}
ForceLogout();
}
catch (Exception exception)
{
Expand Down

0 comments on commit 51e529b

Please sign in to comment.