Use ConfigureAwait in SharedHttpStream
This commit is contained in:
parent
4ec32b71f5
commit
3ecd68d832
|
@ -83,14 +83,27 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
Logger.LogInformation("Beginning {StreamType} stream to {FilePath}", GetType().Name, TempFilePath);
|
Logger.LogInformation("Beginning {StreamType} stream to {FilePath}", GetType().Name, TempFilePath);
|
||||||
using (response)
|
using (response)
|
||||||
{
|
{
|
||||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
await using var fileStream = new FileStream(TempFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous);
|
await using (stream.ConfigureAwait(false))
|
||||||
await StreamHelper.CopyToAsync(
|
{
|
||||||
stream,
|
var fileStream = new FileStream(
|
||||||
fileStream,
|
TempFilePath,
|
||||||
IODefaults.CopyToBufferSize,
|
FileMode.Create,
|
||||||
() => Resolve(openTaskCompletionSource),
|
FileAccess.Write,
|
||||||
cancellationToken).ConfigureAwait(false);
|
FileShare.Read,
|
||||||
|
IODefaults.FileStreamBufferSize,
|
||||||
|
FileOptions.Asynchronous);
|
||||||
|
|
||||||
|
await using (fileStream.ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
await StreamHelper.CopyToAsync(
|
||||||
|
stream,
|
||||||
|
fileStream,
|
||||||
|
IODefaults.CopyToBufferSize,
|
||||||
|
() => Resolve(openTaskCompletionSource),
|
||||||
|
cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException ex)
|
catch (OperationCanceledException ex)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user