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