Commit Graph

34 Commits

Author SHA1 Message Date
JimMoen a11208b307 fix(frame): variable byte num not limited in 4 bytes 2021-11-12 11:36:11 +08:00
Shawn 238eaa8e40 fix(emqx): validate mqtt malformed variable byte integer 2021-03-10 19:42:44 +08:00
JianBo He ca0f6b69a4 chore: supply the code_change logic 2020-12-04 22:33:29 +08:00
JianBo He 80c503fd64 refactor(conn): not saving anonymous func 2020-12-04 22:33:29 +08:00
JianBo He e3489b9d46 refactor(style): improve all types declaration
- Add dialyzer for code analysis
- Correct all the module type declarations
- Use `-type()` to declaration a type instead of `-opaque`
  (It is advantageous to the code dialyzer)

BROKEN CHANGES:
- Add a ?DEFAULT_SUBOPTS for emqx_broker:subscribe/1,2,3
- Remove the needless internal function `emqx_vm:port_info(PortTerm, Keys)`
2020-06-18 17:38:34 +08:00
terry-xiaoyu 6ad65d587e feature(properties): add properties in message header
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`.
2020-06-17 18:46:26 +08:00
zhouzb 7ea75f4289 Update copyright 2020-01-03 18:31:08 +08:00
Feng Lee d3107facf9 Validate packet id if strict mode. 2019-11-14 09:46:56 +08:00
Feng Lee 8ab682151d Improve the connection and channel modules
- Rename the 'client_id' field to 'clientid'
- Support publish stats in channel module
- Update test cases for frame and channel modules
2019-09-29 10:22:02 +08:00
Feng Lee 20ddd498fc Rename the 'client_id' field to 'clientid' 2019-09-24 17:06:25 +08:00
Feng Lee 681ae511a8 Introduce the 'strict_mode' option and validate MQTT header (#2898)
Introduce the 'strict_mode' option and validate MQTT header
2019-09-16 14:02:31 +08:00
Feng Lee 6b84eb0595 Rewrite the channel, protocol and session modules. 2019-07-22 17:08:53 +08:00
Feng Lee 42da51e1c5 Implement batch delivery for the new channel design
- Implement a new emqx_channel module
- Improve the emqx_frame:serialize/2 API
- Improve the emqx_connection, emqx_ws_connection modules
2019-07-02 13:40:52 +08:00
Feng Lee 4974eab20e Improve the channel design 2019-06-25 14:53:45 +08:00
Feng Lee 1d88f8fd9e Improve the emqx_connection, emqx_ws_connection and emqx_frame modules (#2611)
* 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
2019-06-14 12:44:27 +08:00
Gilbert Wong bcbb4b68e9 Add flapping detect feature 2019-04-19 16:34:33 +08:00
HeeeJianBo fc2df9aff5 Adapt to new export style 2019-03-22 14:58:24 +08:00
Feng Lee c8b243ed22 Change some '-type' attrs to '-opaque' and improve emqx_gc, emqx_inflight modules
- Define 'GCS(St)' macro to improve emqx_gc module
- Define 'Inflight(MaxSize, Tree)' macro to improve emqx_inflight module
2019-02-22 18:08:13 +08:00
turtled 31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
Gilbert Wong a748e8f1d8 Refactor send_fun in protocol and other connection module
Prior to this change, in the send function, the packet is forced to
use emqx:serialize to serialize packet, it is a wrong design because
other plugins which need to transform the mqtt packet to other packets
can not use their own serialize function to serialize packet.

This change solve the problem issued above.
2018-10-18 13:24:06 +08:00
周子博 d819ec0b58 Comment unused function in emqx_frame.erl 2018-09-07 10:18:21 +08:00
周子博 917eb8e29f Make DISCONNECT packet with reason code 0x00 when this packet doesn't have payload 2018-09-06 17:17:09 +08:00
周子博 f0f818ab1a Fix bug in emqx_frame 2018-09-05 10:28:49 +08:00
周子博 842f4fbf13 Crash when reserved flag in CONNECT packet doesn't equal to 0, and remove repeated check for protocol version 2018-09-04 11:16:15 +08:00
Feng Lee 567aeb274f Define types in emqx_types, emqx_mqtt_types modules 2018-08-29 23:08:55 +08:00
Feng Lee 8e11845f87 Remove ignore_loop_deliver option 2018-08-28 07:36:22 +08:00
Feng Lee 612c88e71e Add 'rc' and 'subid' fields 2018-08-25 16:04:21 +08:00
Feng Lee 0f052ce352 Upgrade connection, protocol and session modules for MQTT 5.0 2018-08-24 18:39:59 +08:00
Feng Lee 4005d58166 Move the 'rate_limit' option from zone to listener 2018-08-08 19:31:25 +08:00
Feng Lee 7d0cba9427 Add MQTT 5.0 supports for connection, protocol and session modules 2018-08-06 16:33:10 +08:00
Feng Lee 62aa072f2f Upgrade for MQTT Version 5.0 and Erlang/OTP R21 2018-07-18 13:43:17 +08:00
Feng Lee b733a3bcfb Throw mqtt_frame_too_large exception if the sent frame is too large 2018-06-12 12:10:53 +08:00
Feng Lee bffdd2ba74 Upgrade esockd and add more test cases 2018-05-22 13:01:19 +08:00
Feng Lee c11e8f453b Add test cases for MQTT 5.0 frame 2018-05-09 00:42:41 +08:00