Use updated request cancellation API.

This commit is contained in:
Chris Ross 2014-06-19 09:12:02 -07:00
parent 93e27e2e40
commit 80eb5ab745
1 changed files with 4 additions and 4 deletions

View File

@ -319,14 +319,14 @@ namespace Microsoft.AspNet.StaticFiles
var sendFile = _context.GetFeature<IHttpSendFileFeature>(); var sendFile = _context.GetFeature<IHttpSendFileFeature>();
if (sendFile != null && !string.IsNullOrEmpty(physicalPath)) if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
{ {
await sendFile.SendFileAsync(physicalPath, 0, _length, _request.CallCanceled); await sendFile.SendFileAsync(physicalPath, 0, _length, _context.OnRequestAborted);
return; return;
} }
Stream readStream = _fileInfo.CreateReadStream(); Stream readStream = _fileInfo.CreateReadStream();
try try
{ {
await StreamCopyOperation.CopyToAsync(readStream, _response.Body, _length, _request.CallCanceled); await StreamCopyOperation.CopyToAsync(readStream, _response.Body, _length, _context.OnRequestAborted);
} }
finally finally
{ {
@ -365,7 +365,7 @@ namespace Microsoft.AspNet.StaticFiles
var sendFile = _context.GetFeature<IHttpSendFileFeature>(); var sendFile = _context.GetFeature<IHttpSendFileFeature>();
if (sendFile != null && !string.IsNullOrEmpty(physicalPath)) if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
{ {
await sendFile.SendFileAsync(physicalPath, start, length, _request.CallCanceled); await sendFile.SendFileAsync(physicalPath, start, length, _context.OnRequestAborted);
return; return;
} }
@ -373,7 +373,7 @@ namespace Microsoft.AspNet.StaticFiles
try try
{ {
readStream.Seek(start, SeekOrigin.Begin); // TODO: What if !CanSeek? readStream.Seek(start, SeekOrigin.Begin); // TODO: What if !CanSeek?
await StreamCopyOperation.CopyToAsync(readStream, _response.Body, length, _request.CallCanceled); await StreamCopyOperation.CopyToAsync(readStream, _response.Body, length, _context.OnRequestAborted);
} }
finally finally
{ {