Prior to this commit, there was a bug in emqx_frame:split/2
the tail number of bytes was used for header number of bytes
whens split. As a result, if the tail happens to be longer
then haeder, the parsing state becomes invalid and it crashes
when the next packet arrives
The split was a over-engineered micro-optimization, so it
has been deleted instead of fixed
1. Add MQTT5.0 properties when invoking the hooks.
- Add a new key `properties` into the message header:
We used to put all of the properties into the `#message.headers`:
```erlang
#message{headers = #{'User-Property' => {<<"reason">>,<<"normal">>},
'Message-Expiry-Interval' => 60,
allow_publish => true}
```
I put them instead under a single key:
```erlang
#message{headers = #{properties =>
#{'User-Property' => {<<"reason">>,<<"normal">>},
'Message-Expiry-Interval' => 60},
allow_publish => true}
```
Note that the column `properties` may contain all the properties for
Publish and Will messages.
- Add `disconn_props` into the `Channel.conninfo`
- Add `puback_props` also into the message header:
```erlang
#message{headers = #{puback_props =>
#{'User-Property' => {<<"reason">>,<<"normal">>}},
allow_publish => true}
```
2. Change the data type of `#message.headers` and `#message.flags` to map.
It used to support `undefined`.
* Adopt channel architecture and improve the MQTT frame parser
* Update the test cases for emqx_channel, emqx_protocol
- Improve emqx_client to Use the new emqx_frame:parse/2
- Update the ct suites for emqx_channel, emqx_ws_channel
* Fix test case