Skip to content

Commit

Permalink
fix write unsubcribe
Browse files Browse the repository at this point in the history
  • Loading branch information
GunnarMorrigan committed Nov 28, 2024
1 parent 0a009ca commit 621b517
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mqrstt/src/packets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ mod tests {

let wire_len = packet.wire_len();
assert_eq!(wire_len, buffer.len());
dbg!(wire_len);
let a: Vec<_> = buffer.iter().map(|f| *f as u16).collect();
println!("{:?}", a);

let res1 = Packet::read(&mut buffer).unwrap();

Expand Down Expand Up @@ -598,9 +601,11 @@ mod tests {
use crate::packets::WireLength;

let mut buffer = Vec::with_capacity(1000);
packet.async_write(&mut buffer).await.unwrap();
let res = packet.async_write(&mut buffer).await.unwrap();

let wire_len = packet.wire_len();

assert_eq!(res, wire_len);
assert_eq!(wire_len, buffer.len());

let mut buf = buffer.as_slice();
Expand Down
2 changes: 2 additions & 0 deletions mqrstt/src/packets/unsubscribe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ where
let mut total_written_bytes = 2;
stream.write_u16(self.packet_identifier).await?;

total_written_bytes += self.properties.async_write(stream).await?;

for topic in &self.topics {
total_written_bytes += topic.async_write(stream).await?;
}
Expand Down

0 comments on commit 621b517

Please sign in to comment.