|
|
|
|
@ -110,26 +110,24 @@ fn parse_properties(input: &[u8], precond: bool) -> IResult<&[u8], Option<Vec<MQ
|
|
|
|
|
}
|
|
|
|
|
// parse properties length
|
|
|
|
|
match parse_mqtt_variable_integer(input) {
|
|
|
|
|
Ok((rem, mut proplen)) => {
|
|
|
|
|
Ok((rem, proplen)) => {
|
|
|
|
|
if proplen == 0 {
|
|
|
|
|
// no properties
|
|
|
|
|
return Ok((rem, None));
|
|
|
|
|
}
|
|
|
|
|
// parse properties
|
|
|
|
|
let mut props = Vec::<MQTTProperty>::new();
|
|
|
|
|
let mut newrem = rem;
|
|
|
|
|
while proplen > 0 {
|
|
|
|
|
let (rem, mut newrem) = take!(rem, proplen as usize)?;
|
|
|
|
|
while newrem.len() > 0 {
|
|
|
|
|
match parse_property(newrem) {
|
|
|
|
|
Ok((rem, val)) => {
|
|
|
|
|
Ok((rem2, val)) => {
|
|
|
|
|
props.push(val);
|
|
|
|
|
let curparselen = (newrem.len() - rem.len()) as u32;
|
|
|
|
|
proplen -= curparselen;
|
|
|
|
|
newrem = &rem;
|
|
|
|
|
newrem = rem2;
|
|
|
|
|
}
|
|
|
|
|
Err(e) => return Err(e),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Ok((newrem, Some(props)));
|
|
|
|
|
return Ok((rem, Some(props)));
|
|
|
|
|
}
|
|
|
|
|
Err(e) => return Err(e),
|
|
|
|
|
}
|
|
|
|
|
|