Fix zero bytes being used when deserializing

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/1/head
trivernis 4 years ago
parent 4991dbb20f
commit 085ed6ee04
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -69,8 +69,8 @@ impl RpcServer {
for _ in 0..(length as f32 / BUF_SIZE as f32).ceil() as usize { for _ in 0..(length as f32 / BUF_SIZE as f32).ceil() as usize {
let mut buf = [0u8; BUF_SIZE]; let mut buf = [0u8; BUF_SIZE];
incoming.read(&mut buf)?; let read_size = incoming.read(&mut buf)?;
data.append(&mut buf.to_vec()) data.append(&mut buf[0..read_size].to_vec())
} }
log::trace!("Message read as {:?}", data); log::trace!("Message read as {:?}", data);

Loading…
Cancel
Save