Update emqtt_frame.erl#281
Conversation
| parse_topic_filters(subscribe, Bin) -> | ||
| [{Topic, #{rh => Rh, rap => Rap, nl => Nl, qos => QoS}} | ||
| || <<Len:16/big, Topic:Len/binary, _:2, Rh:2, Rap:1, Nl:1, QoS:2>> <= Bin]; | ||
| || <<_:8, Len:16/big, Topic:Len/binary, _:2, Rh:2, Rap:1, Nl:1, QoS:2>> <= Bin]; |
There was a problem hiding this comment.
I cannot seem to find why there is one leading byte before the string length.
|
hello @zmstone, sorry about the lac of the context, i have try to create an tcp elixir "mqtt proxy" to a broker, and i have using this lib to parse mqtt packets, |
|
Had a quick look into the server side code (which is extensively tested) here: https://github.com/emqx/emqx/blob/bc7668078c80bf51ad996342e8ee6681adce41a4/apps/emqx/src/emqx_frame.erl#L659-L665 They seem to be the same, and I cannot seem to spot where the leading byte might have leaked from.
|
fix the packet parser to retrive the topic name