Skip to content

Commit 621b517

Browse files
fix write unsubcribe
1 parent 0a009ca commit 621b517

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

mqrstt/src/packets/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,9 @@ mod tests {
509509

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

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

@@ -598,9 +601,11 @@ mod tests {
598601
use crate::packets::WireLength;
599602

600603
let mut buffer = Vec::with_capacity(1000);
601-
packet.async_write(&mut buffer).await.unwrap();
604+
let res = packet.async_write(&mut buffer).await.unwrap();
602605

603606
let wire_len = packet.wire_len();
607+
608+
assert_eq!(res, wire_len);
604609
assert_eq!(wire_len, buffer.len());
605610

606611
let mut buf = buffer.as_slice();

mqrstt/src/packets/unsubscribe/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ where
110110
let mut total_written_bytes = 2;
111111
stream.write_u16(self.packet_identifier).await?;
112112

113+
total_written_bytes += self.properties.async_write(stream).await?;
114+
113115
for topic in &self.topics {
114116
total_written_bytes += topic.async_write(stream).await?;
115117
}

0 commit comments

Comments
 (0)