FileSink doesn't need chunk_size

This commit is contained in:
asonix 2020-05-25 15:01:57 -05:00
parent 84e7f8153e
commit f7769b049a

View file

@ -92,7 +92,6 @@ impl FileStream {
struct FileSink<E> {
file: Option<File>,
fut: Option<LocalBoxFuture<'static, Result<File, BlockingError<io::Error>>>>,
chunk_size: u64,
closing: bool,
_error: PhantomData<E>,
}
@ -102,7 +101,6 @@ impl<E> FileSink<E> {
FileSink {
file: Some(file),
fut: None,
chunk_size: 0,
closing: false,
_error: PhantomData,
}
@ -250,7 +248,6 @@ where
Poll::Ready(Ok(file)) => {
self.fut.take();
self.file = Some(file);
self.chunk_size = 0;
Poll::Ready(Ok(()))
}
@ -264,7 +261,6 @@ where
fn start_send(mut self: Pin<&mut Self>, item: Bytes) -> Result<(), Self::Error> {
let mut file = self.file.take().expect("Use after completion");
self.chunk_size = item.len() as u64;
self.fut = Some(
actix_threadpool::run(move || {
@ -287,7 +283,6 @@ where
match Pin::new(fut).poll(cx) {
Poll::Ready(Ok(file)) => {
self.file = Some(file);
self.chunk_size = 0;
}
Poll::Ready(Err(e)) => return Poll::Ready(Err(Error::from(e).into())),
Poll::Pending => return Poll::Pending,