fix disposed semaphores
This commit is contained in:
@@ -239,12 +239,22 @@ public class ServerFilesController : ControllerBase
|
|||||||
return BadRequest();
|
return BadRequest();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
fileLock?.Release();
|
fileLock?.Release();
|
||||||
fileLock?.Dispose();
|
fileLock?.Dispose();
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
// it's disposed whatever
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
_fileUploadLocks.TryRemove(hash, out _);
|
_fileUploadLocks.TryRemove(hash, out _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost(MareFiles.ServerFiles_UploadMunged + "/{hash}")]
|
[HttpPost(MareFiles.ServerFiles_UploadMunged + "/{hash}")]
|
||||||
[RequestSizeLimit(200 * 1024 * 1024)]
|
[RequestSizeLimit(200 * 1024 * 1024)]
|
||||||
@@ -326,12 +336,22 @@ public class ServerFilesController : ControllerBase
|
|||||||
return BadRequest();
|
return BadRequest();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
fileLock?.Release();
|
fileLock?.Release();
|
||||||
fileLock?.Dispose();
|
fileLock?.Dispose();
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
// it's disposed whatever
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
_fileUploadLocks.TryRemove(hash, out _);
|
_fileUploadLocks.TryRemove(hash, out _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void MungeBuffer(Span<byte> buffer)
|
private static void MungeBuffer(Span<byte> buffer)
|
||||||
{
|
{
|
||||||
@@ -421,10 +441,20 @@ public class ServerFilesController : ControllerBase
|
|||||||
return BadRequest();
|
return BadRequest();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
fileLock?.Release();
|
fileLock?.Release();
|
||||||
fileLock?.Dispose();
|
fileLock?.Dispose();
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
// it's disposed whatever
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
_fileUploadLocks.TryRemove(hash, out _);
|
_fileUploadLocks.TryRemove(hash, out _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user