Working example of client

This commit is contained in:
Ondrej Babec
2022-02-26 15:12:19 +01:00
parent a862637a77
commit 3cb9de0371
17 changed files with 242 additions and 135 deletions

View File

@@ -150,6 +150,7 @@ impl<'a> BuffReader<'a> {
log::error!("Could not parse utf-8 string");
return Err(ParseError::Utf8Error);
}
self.increment_position(len_res as usize);
return Ok(EncodedString {
string: res_str.unwrap(),
len: len_res,
@@ -188,7 +189,7 @@ impl<'a> BuffReader<'a> {
});
}
pub fn read_message(&mut self) -> &'a [u8] {
return &self.buffer[self.position..];
pub fn read_message(&mut self, total_len: usize) -> &'a [u8] {
return &self.buffer[self.position..total_len];
}
}