refactor(replay/recorder): write directly to zip file
This commit is contained in:
parent
a957aaeaec
commit
3e672c4d1a
@ -68,11 +68,12 @@ impl Recorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn save_raw_packet(&mut self, raw_packet: &[u8]) -> Result<()> {
|
pub fn save_raw_packet(&mut self, raw_packet: &[u8]) -> Result<()> {
|
||||||
let mut data = Vec::with_capacity(raw_packet.len() + 8);
|
self.zip_writer.write_all(
|
||||||
data.extend(TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes());
|
&TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes(),
|
||||||
data.extend(TryInto::<u32>::try_into(raw_packet.len())?.to_be_bytes());
|
)?;
|
||||||
data.extend(raw_packet);
|
self.zip_writer
|
||||||
self.zip_writer.write_all(&data)?;
|
.write_all(&TryInto::<u32>::try_into(raw_packet.len())?.to_be_bytes())?;
|
||||||
|
self.zip_writer.write_all(raw_packet)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user