Fix processing of empty chunk when finishing

master
trivernis 5 years ago
parent ed1123bf25
commit 0620f1a682

@ -1,6 +1,6 @@
[package]
name = "bdflib"
version = "0.3.2"
version = "0.3.3"
authors = ["trivernis <trivernis@gmail.com>"]
edition = "2018"
license-file = "LICENSE"

@ -164,10 +164,16 @@ impl BDFWriter {
}
self.thread_manager.sender_result.send(data_chunk.serialize()).expect("failed to send serialization result");
}
self.write_serialized()?;
self.data_entries = Vec::new();
Ok(())
}
fn write_serialized(&mut self) -> Result<(), Error> {
while let Ok(data) = self.thread_manager.receiver_result.try_recv() {
self.writer.write(data.as_slice())?;
}
self.data_entries = Vec::new();
Ok(())
}
@ -184,7 +190,7 @@ impl BDFWriter {
self.flush()?;
self.thread_manager.drop_sender();
self.thread_manager.wait();
self.flush()?;
self.write_serialized()?;
self.flush_writer()?;
Ok(())

Loading…
Cancel
Save