mirror of https://github.com/fafhrd91/actix-web
Update fs.rs
This commit is contained in:
parent
6df11f7abe
commit
971f732f69
15
src/fs.rs
15
src/fs.rs
|
@ -351,7 +351,8 @@ impl<C: StaticFileConfig> Responder for NamedFile<C> {
|
||||||
if let Some(current_encoding) = self.encoding {
|
if let Some(current_encoding) = self.encoding {
|
||||||
resp.content_encoding(current_encoding);
|
resp.content_encoding(current_encoding);
|
||||||
}
|
}
|
||||||
let reader = ChunkedReadFile {
|
let reader =
|
||||||
|
{
|
||||||
size: self.md.len(),
|
size: self.md.len(),
|
||||||
offset: 0,
|
offset: 0,
|
||||||
cpu_pool: self.cpu_pool.unwrap_or_else(|| req.cpu_pool().clone()),
|
cpu_pool: self.cpu_pool.unwrap_or_else(|| req.cpu_pool().clone()),
|
||||||
|
@ -475,12 +476,12 @@ impl<C: StaticFileConfig> Responder for NamedFile<C> {
|
||||||
/// A helper created from a `std::fs::File` which reads the file
|
/// A helper created from a `std::fs::File` which reads the file
|
||||||
/// chunk-by-chunk on a `CpuPool`.
|
/// chunk-by-chunk on a `CpuPool`.
|
||||||
pub struct ChunkedReadFile {
|
pub struct ChunkedReadFile {
|
||||||
size: u64,
|
pub size: u64,
|
||||||
offset: u64,
|
pub offset: u64,
|
||||||
cpu_pool: CpuPool,
|
pub cpu_pool: CpuPool,
|
||||||
file: Option<File>,
|
pub file: Option<File>,
|
||||||
fut: Option<CpuFuture<(File, Bytes), io::Error>>,
|
pub fut: Option<CpuFuture<(File, Bytes), io::Error>>,
|
||||||
counter: u64,
|
pub counter: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Stream for ChunkedReadFile {
|
impl Stream for ChunkedReadFile {
|
||||||
|
|
Loading…
Reference in New Issue