open download filestream with fileshare read

This commit is contained in:
Stanley Dimant
2022-07-10 01:13:08 +02:00
parent 0b458c0f87
commit 9c63ce9c99

View File

@@ -71,7 +71,7 @@ namespace MareSynchronosServer.Hubs
int readByteCount; int readByteCount;
var buffer = new byte[chunkSize]; var buffer = new byte[chunkSize];
await using var fs = File.Open(Path.Combine(BasePath, hash), FileMode.Open, FileAccess.Read); await using var fs = File.Open(Path.Combine(BasePath, hash), FileMode.Open, FileAccess.Read, FileShare.Read);
while ((readByteCount = await fs.ReadAsync(buffer, 0, chunkSize, ct)) > 0) while ((readByteCount = await fs.ReadAsync(buffer, 0, chunkSize, ct)) > 0)
{ {
await Task.Delay(10, ct); await Task.Delay(10, ct);