src/backup/chunk_stream.rs: assemble data with correct order

This commit is contained in:
Dietmar Maurer 2019-05-22 07:44:51 +02:00
parent d0afeaa831
commit 02fa54ff3c

View File

@ -43,9 +43,14 @@ impl <S: Stream<Item=Vec<u8>, Error=Error>> Stream for ChunkStream<S> {
return Ok(Async::Ready(None));
}
}
Ok(Async::Ready(Some(mut data))) => {
Ok(Async::Ready(Some(data))) => {
if let Some(rest) = self.rest.take() { data.extend(rest); }
let data = if let Some(mut rest) = self.rest.take() {
rest.extend(data);
rest
} else {
data
};
let buffer = self.buffer.get_or_insert_with(|| Vec::with_capacity(1024*1024));
let boundary = self.chunker.scan(&data);