mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-15 05:04:16 +01:00
mak server read files synchronous
This commit is contained in:
parent
f8ecd3965d
commit
fcf38994bc
2 changed files with 2 additions and 3 deletions
2
MareAPI
2
MareAPI
|
|
@ -1 +1 @@
|
||||||
Subproject commit af8516d44a99d3a46e2a0de36c848732937f9c6a
|
Subproject commit ffc0a48fdadd71d33b015e4e46ef15303f1d2f60
|
||||||
|
|
@ -68,9 +68,8 @@ namespace MareSynchronosServer.Hubs
|
||||||
|
|
||||||
var path = Path.Combine(BasePath, hash);
|
var path = Path.Combine(BasePath, hash);
|
||||||
await using var fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
|
await using var fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||||
while ((readByteCount = await fs.ReadAsync(buffer, 0, chunkSize, ct)) > 0)
|
while ((readByteCount = fs.Read(buffer, 0, chunkSize)) > 0)
|
||||||
{
|
{
|
||||||
await Task.Delay(10, ct);
|
|
||||||
yield return readByteCount == chunkSize ? buffer.ToArray() : buffer.Take(readByteCount).ToArray();
|
yield return readByteCount == chunkSize ? buffer.ToArray() : buffer.Take(readByteCount).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue