Skip to content

Commit

Permalink
TopicAlias 0 错误码应当为0x94 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
evildao authored Sep 15, 2023
1 parent 61e59bc commit d519519
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/packets/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,10 @@ func (p *Properties) Unpack(bufr *bytes.Buffer, packetType byte) error {
case PropTopicAliasMaximum:
p.TopicAliasMaximum, err = propertyReadUint16(p.TopicAliasMaximum, newBufr, propType, nil)
case PropTopicAlias:
p.TopicAlias, err = propertyReadUint16(p.TopicAlias, newBufr, propType, func(u uint16) bool {
return u != 0 // [MQTT-3.3.2-8]
})
p.TopicAlias, err = propertyReadUint16(p.TopicAlias, newBufr, propType, nil)
if p.TopicAlias != nil && *p.TopicAlias == 0 {
err = codes.NewError(codes.TopicAliasInvalid)
}
case PropMaximumQoS:
p.MaximumQoS, err = propertyReadBool(p.MaximumQoS, newBufr, propType)
case PropRetainAvailable:
Expand Down

0 comments on commit d519519

Please sign in to comment.