Skip to content

Commit

Permalink
Fixed PublishProperties::encode(), 'sub_ids' encode error
Browse files Browse the repository at this point in the history
  • Loading branch information
rmqtt committed Aug 21, 2023
1 parent 54dfca3 commit af103c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/v5/codec/packet/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ impl EncodeLtd for PublishProperties {
+ encoded_property_size(&self.is_utf8_payload)
+ encoded_property_size(&self.response_topic)
+ self.subscription_ids.as_ref().map_or(0, |v| {
v.iter().fold(0, |acc, id| acc + 1 + var_int_len(id.get() as usize) as usize)
})
v.iter().fold(0, |acc, id| acc + 1 + var_int_len(id.get() as usize) as usize)
})
+ self.user_properties.encoded_size();
prop_len + var_int_len(prop_len) as usize
}
Expand All @@ -183,7 +183,7 @@ impl EncodeLtd for PublishProperties {
if let Some(sub_ids) = self.subscription_ids.as_ref() {
for sub_id in sub_ids.iter() {
buf.put_u8(pt::SUB_ID);
sub_id.encode(buf)?;
utils::write_variable_length(sub_id.get(), buf);
}
}
self.user_properties.encode(buf)
Expand Down

0 comments on commit af103c0

Please sign in to comment.