From 51e529bcb549f7b7f068315fff056b87f4c0048f Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Wed, 13 Nov 2024 20:43:52 +0000 Subject: [PATCH] Fix: Avoid the logout timer trying to acquire the lock twice --- .../AniDB/UDP/AniDBUDPConnectionHandler.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs b/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs index b95286709..f58babfca 100644 --- a/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs +++ b/Shoko.Server/Providers/AniDB/UDP/AniDBUDPConnectionHandler.cs @@ -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) {