mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-15 13:34:15 +01:00
fix disposed semaphores
This commit is contained in:
parent
a1573ad2c3
commit
5a4010cb8a
1 changed files with 39 additions and 9 deletions
|
|
@ -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 _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue