Commit Graph

153 Commits

Author SHA1 Message Date
Feng Lee 578355442b Add more metrics and improve the 'channel', 'session' modules (#3128) 2019-12-20 21:47:32 +08:00
张奇怪 2cf3af12ef Update test cases for emqx_connection (#3116) 2019-12-20 19:15:45 +08:00
Feng Lee 1f25f4439f Remove the 'stop_reason' field 2019-12-16 12:45:46 +08:00
Feng Lee 635c3f75fe Improve the 'emqx_connection' module for CT 2019-12-16 11:25:47 +08:00
Feng Lee 2ef52828bc Improve 'emqx_connection' module and update test cases 2019-12-16 11:25:47 +08:00
Feng Lee c5c99b7c4e Improve 'emqx_ws_connection' module and add more test cases 2019-12-13 18:07:59 +08:00
Feng Lee 9c3273a2c6 Improve the process of handling MQTT control packets (#3079) 2019-12-06 19:51:06 +08:00
Feng Lee 1af1fc4f6a Fix the check of limiter 2019-11-18 11:51:58 +08:00
Feng Lee 4935ba11a8 Upgrade deps to ekka v0.7.0 and esockd v5.6.0 2019-11-18 10:40:53 +08:00
Feng Lee 2b1b58fc66 Add the new 'emqx_limiter' module 2019-11-01 08:10:58 +08:00
Feng Lee 7117dde879 Add more test cases for connection, channel and session modules 2019-10-21 17:14:50 +08:00
Feng Lee cd4adbada0 Add more test cases for connection, channel and session modules 2019-10-18 18:53:31 +08:00
Feng Lee 6233aa7d46 Ensure the 'conn_state' be 'disconnected' after socket closed 2019-10-12 19:14:33 +08:00
Feng Lee cce0dbd3cf Improve the connection, ws_connection and channel modules 2019-10-12 17:05:37 +08:00
Feng Lee e718fa8249 Rewrite the 'emqx_connection' module using a raw erlang process 2019-10-08 17:59:11 +08:00
zhouzb ddd68e600d Fix missing cases 2019-09-29 15:32:53 +08:00
Feng Lee 977b551bbf Fix the test cases for session, channel and connection modules 2019-09-29 10:53:59 +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
terry-xiaoyu eb0826ef3f Fix testcases for new object field protocol 2019-09-21 12:37:08 +08:00
Feng Lee 1a3261b186
Merge branch 'develop' into remove-protocol-module 2019-09-20 16:17:44 +08:00
zhouzb a9dd94b2b5 Improve mechanism of waiting for session to expire 2019-09-20 15:01:51 +08:00
Feng Lee 1d429dad8d Update the 'attrs/1' and 'handle_timeout/3' functions 2019-09-18 20:01:22 +08:00
zhouzb 600cd11f1f Rename connection to conninfo 2019-09-16 17:22:50 +08:00
Feng Lee 4764a7707c Rewrite the emqx_packet module and improve channel pipeline (#2903)
Add use_username_as_clientid/1 function and Improve function 'pipeline/3'
2019-09-16 14:17:36 +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
tigercl 35822ff97a
Fix handling for MQTT spec (#2892)
Fix invalid QoS and protocol name, fix handling for Topic-Alias-Maximum and Maximum-Packet-Size, and send DISCONNECT Packet to client when the session is taken over
2019-09-16 13:51:50 +08:00
terry-xiaoyu 1e4c51f080 Send DISCONNECT on packet parse error 2019-09-05 18:16:15 +08:00
Feng Lee 847375d2fb Improve connection and channel modules (#2860)
Improve the connection and channel modules
2019-09-05 14:17:15 +08:00
zhouzb 98072dd3d1 Set stats at connection time 2019-08-26 16:43:08 +08:00
Feng Lee 738145677a Handle the 'discard' cast. 2019-08-23 14:31:33 +08:00
Feng Lee 82b9a7c301 Improve session takeover (#2831)
Implement the session takover/resumption across nodes
2019-08-23 14:09:00 +08:00
Feng Lee c69a2b1b48 Ensure session expiration (#2825)
Ensure session expiration
2019-08-23 09:35:29 +08:00
Feng Lee 8b03371a4a Improve the keepalive, connection, channel and session modules (#2813) 2019-08-22 16:38:25 +08:00
tigercl 749ef823ab
Refix code about mqtt spec (#2806)
Refix code about mqtt spec
2019-08-19 10:50:52 +08:00
Feng Lee f2b552e29e Ensure stats timer 2019-08-19 09:43:58 +08:00
Feng Lee f26505d40a Implement session takeover and resumption.
- Implement session takeover
- Remove `init_proc_mng_policy/1' from emqx_misc module
- Remove `conn_proc_mng_policy/1' from emqx_misc module
- Add `emqx_oom' module to monitor OOM of channel process
2019-08-17 13:37:48 +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
Feng Lee f801ff1e53 Optimize metrics using counters and persistent_term (#2597)
* Optimize emqx_metrics module using persistent_term and counters in OTP 22
2019-06-05 23:16:35 +08:00
Gilbert 0857b976ed Better zone (#2548) 2019-05-25 22:29:23 +08:00
JianBo He 97cca1a5ba Set {active, N} for ssl connection (#2531) 2019-05-13 10:18:01 +08:00
Gilbert Wong bcbb4b68e9 Add flapping detect feature 2019-04-19 16:34:33 +08:00
Gilbert Wong f1616c33d9 Convert value of attribute table to map 2019-04-13 10:35:59 +08:00
周子博 0fbf771543 Readjust log level into error when got unexpected message 2019-03-27 11:07:58 +08:00
周子博 58e1b4d485 Readjust log level and unify log format 2019-03-26 22:18:31 +08:00
HeeeJianBo fc2df9aff5 Adapt to new export style 2019-03-22 14:58:24 +08:00
JianBo He 8a73c62f66 Fix followed packet parse failure (#2333)
To fix issue#2303(https://github.com/emqx/emqx/issues/2303)
It will report the following error, when a connection sends a TCP frame contained many of MQTT packet and followed a split MQTT packet.
2019-03-20 10:14:52 +08:00
Gilbert Wong 763115e149 Delegate serialize fun into sendfun 2019-03-16 21:15:10 +08:00
turtled 22aa7d4668 Rm acl_deny_action_ct test case 2019-02-28 22:19:19 +08:00
turtled c8e2840126 Merge fix conflicts 2019-02-28 17:02:39 +08:00
Feng Lee 08204fc7a8 Improve the emqx_connection module using gen_statem behaviour (#2235) 2019-02-28 15:08:29 +08:00
linjun 16165ce935 Use conn_mod instead of socktype 2019-02-28 11:32:05 +08:00
linjun 44529a278d Adjusting code 2019-02-27 14:39:49 +08:00
linjun 7af6051e25 Refactor code 2019-02-27 13:54:24 +08:00
linjun 760ac9f2f9 Add the value of attribute socktype in emqx_conn_type table 2019-02-27 11:09:45 +08:00
turtled 31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
Feng Lee d7254cdc7f Add more macros for logger 2019-01-04 17:30:27 +08:00
terry-xiaoyu 3b8eb41347 Remove the log header macro 2019-01-04 17:30:27 +08:00
YoukiLin 78b3c375d8
Improving 'emqx_ws_connection' coverage (#2107) 2019-01-03 12:59:39 +08:00
Feng Lee 10e5210581 Workaround ssl:setopts(SslSock, [{active, N}]) (#2095)
* Set '{active, true}' for SSL socket
2018-12-21 15:39:24 +08:00
Feng Lee 3fec9cdf0a Try to simulate a '{ssl_passive, Sock}' message:( 2018-12-21 12:03:40 +08:00
Feng Lee 367b717c40 Implement a new 'emqx_gc' module (#2090)
Update connection/session module to using the new emqx_gc API
2018-12-20 22:42:18 +08:00
Feng Lee 14cffcf7fb Add the 'emqx_pd' module
Add utility functions for erlang process dictionary
Add test cases for emqx_pd
2018-12-20 16:45:25 +08:00
Feng Lee 14a12e0c6c Move the 'LOG_HEADER' macro above '-include(logger.hrl)' 2018-12-20 14:45:52 +08:00
Feng Lee 6e1b47f1f9 Improve the emqx_connection module
Rename 'publish_limit' to 'pub_limit'
'try ... of ... catch' to replace 'case catch'
2018-12-20 14:45:52 +08:00
Feng Lee 721b72b96a Add 'active_n' option to optimize the CPU usage of emqx_connection (#2060)
* Add 'active_n' option to optimize the CPU usage of emqx_connection

* Supports batch processing 'DOWN' events
2018-12-17 19:53:29 +08:00
周子博 ea62b15c87 Alter apis provided by emqx_metrics, and use existing timer to commit metrics 2018-11-30 17:44:29 +08:00
周子博 194dbc02c8 Add batch commit for metrics 2018-11-30 17:44:29 +08:00
Shawn eeb0cab3e3 Update proc meta-data for empty clientid (#1980) 2018-11-23 18:11:46 +08:00
terry-xiaoyu 82b8047349 Helper funcs for adding proc meta-data 2018-11-19 11:17:58 +08:00
terry-xiaoyu 41315bff0d Log macros for lazy evaluation 2018-11-19 11:17:58 +08:00
terry-xiaoyu 2269967f1a Lazy evaluation when logging messages
Formatting variables and then passing them into the logger functions leads
to performance issues. i.e.

```erlang
logger:debug("RECV ~s", [emqx_packet:format(Packet)])
```

Above message will only be printed when the current log level set to
`debug`, but the function emqx_packet:format/1 will always be evaluated no
matter what the current log level is.

OTP 21 provides a special meta-data named `report_cb`, which can be used
for lazy evaluation. The fun is only evaluated if the primary/handler log level
check passes, and is therefore recommended if it is expensive to generate
the message.
2018-11-19 11:17:58 +08:00
Gilbert Wong 35460d8227 Refactor send_fun 2018-10-22 09:04:03 +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
spring2maz e3f2ae8db8 Change from customized total heap size check to set process flag
The `max_heap_size` process flag can be used to limit total
heap size of a process, and it gives much more detailed
crash log if the limit is hit.
2018-09-29 21:36:34 +08:00
turtleDeng 8653732bae Revert "Calculate the 1.5 keep alive time exactly" 2018-09-22 14:52:31 +08:00
Feng Lee ee7a7e2479
Fix typo 2018-09-22 06:05:29 +08:00
spring2maz b61615323b Move shutdown policy config to zone configs 2018-09-21 18:58:18 +02:00
spring2maz 6fca651a84 Add connection/session shutdown policy
The hibernation behaviour is also changed (implicitly) in this commit:
Prior to this change, connection/session always hibernates after
the stats timer expires regardless of messages in mailbox.
After this commit, connection/session process only goes to hibernate
when the timer expires AND there is nothing left in the mailbox to
process
2018-09-21 18:58:18 +02:00
spring2maz 721f237bc4 Rewrite emqx_gc.erl
The implementation prior to this commit supports
only one gc enforcement policy which is message count threshold.
The new implementation introduces 1 more: volume threshold based
2018-09-21 22:56:34 +08:00
周子博 ab2697671a Change the location of the recording last packet timestamp 2018-09-21 19:59:32 +08:00
周子博 aade94711c Use process dictionaries to record last packet timestamp 2018-09-21 18:50:26 +08:00
周子博 768d1786c7 Fix bug 2018-09-20 15:55:36 +08:00
周子博 073bf481c9 Calculate the 1.5 keep alive time exactly 2018-09-20 15:51:28 +08:00
HuangDan fde6a2a4c3 Fixed issue #1811
Add tests case for issue #1811
2018-09-13 22:55:15 +08:00
Feng Lee ea1ae70833 Fix errors found by dialyzer 2018-08-31 16:46:51 +08:00
Feng Lee 0379219a04 Improve the design of session discard 2018-08-30 23:14:09 +08:00
Feng Lee 53a2f93b7e Add emqx_connection:attrs/1, emqx_protocol:attrs/1, emqx_session:attrs/1 APIs 2018-08-30 03:03:19 +08:00
Feng Lee 1607e576de Update connection, session, stats modules 2018-08-27 21:34:11 +08:00
Feng Lee 68cfcf6e0e Pass paho mqtt interoperability tests 2018-08-24 23:19:11 +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 f80cd2d986 Improve the MQTT over Websocket connection 2018-08-11 17:57:19 +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 7ee54aac28 Add 'qos' field to message record 2018-07-18 23:41:00 +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 bffdd2ba74 Upgrade esockd and add more test cases 2018-05-22 13:01:19 +08:00
Feng Lee 31bc091873 Implement MQTT Version 5.0 client 2018-05-06 17:45:18 +08:00
Feng Lee 2a4ffc6645 Add more service modules for MQTT Version 5.0 2018-04-18 16:34:23 +08:00
Feng Lee 71acf91ace Replace lager with emqx_log 2018-04-09 12:34:53 +08:00
Feng Lee 2eed46310c Misc fix for the MQTT Version 5.0 2018-03-30 17:18:08 +08:00