summaryrefslogtreecommitdiffstats
path: root/mqtt-format/src/v5/packets/pubcomp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mqtt-format/src/v5/packets/pubcomp.rs')
-rw-r--r--mqtt-format/src/v5/packets/pubcomp.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/mqtt-format/src/v5/packets/pubcomp.rs b/mqtt-format/src/v5/packets/pubcomp.rs
index cac4069..c8fe2b0 100644
--- a/mqtt-format/src/v5/packets/pubcomp.rs
+++ b/mqtt-format/src/v5/packets/pubcomp.rs
@@ -46,8 +46,19 @@ impl<'i> MPubcomp<'i> {
pub fn parse(input: &mut &'i Bytes) -> MResult<Self> {
winnow::combinator::trace("MPubcomp", |input: &mut &'i Bytes| {
let packet_identifier = PacketIdentifier::parse(input)?;
- let reason = PubcompReasonCode::parse(input)?;
- let properties = PubcompProperties::parse(input)?;
+
+ let reason = if input.is_empty() {
+ PubcompReasonCode::Success
+ } else {
+ PubcompReasonCode::parse(input)?
+ };
+
+ let properties = if input.is_empty() {
+ PubcompProperties::new()
+ } else {
+ PubcompProperties::parse(input)?
+ };
+
Ok(Self {
packet_identifier,
reason,