fix disposed semaphores

This commit is contained in:
rootdarkarchon
2023-11-18 17:41:18 +01:00
parent a1573ad2c3
commit 5a4010cb8a

View File

@@ -240,9 +240,19 @@ public class ServerFilesController : ControllerBase
} }
finally finally
{ {
fileLock?.Release(); try
fileLock?.Dispose(); {
_fileUploadLocks.TryRemove(hash, out _); fileLock?.Release();
fileLock?.Dispose();
}
catch (ObjectDisposedException)
{
// it's disposed whatever
}
finally
{
_fileUploadLocks.TryRemove(hash, out _);
}
} }
} }
@@ -327,9 +337,19 @@ public class ServerFilesController : ControllerBase
} }
finally finally
{ {
fileLock?.Release(); try
fileLock?.Dispose(); {
_fileUploadLocks.TryRemove(hash, out _); fileLock?.Release();
fileLock?.Dispose();
}
catch (ObjectDisposedException)
{
// it's disposed whatever
}
finally
{
_fileUploadLocks.TryRemove(hash, out _);
}
} }
} }
@@ -422,9 +442,19 @@ public class ServerFilesController : ControllerBase
} }
finally finally
{ {
fileLock?.Release(); try
fileLock?.Dispose(); {
_fileUploadLocks.TryRemove(hash, out _); fileLock?.Release();
fileLock?.Dispose();
}
catch (ObjectDisposedException)
{
// it's disposed whatever
}
finally
{
_fileUploadLocks.TryRemove(hash, out _);
}
} }
} }
} }