Commit Graph

1668 Commits

Author SHA1 Message Date
周子博
3ad5700442 Support getting the history of alarms 2019-06-29 12:38:57 +08:00
terry-xiaoyu
96fff39535 Change default logger level to warning 2019-06-28 21:34:21 +08:00
terry-xiaoyu
0e2e4e73ca Clean staled sesssions 2019-06-26 20:04:32 +08:00
Gilbert
9df6345a6c Remove bridge functions from emqx (#2652)
* Remove bridge functions from emqx
2019-06-26 19:33:17 +08:00
tradingtrace
0b116bc208 Fix the massages order when batch dispatching 2019-06-26 19:32:15 +08:00
Feng Lee
9ee0a4d171 Fix the function_clause error when publishing QoS2 message 2019-06-25 17:35:58 +08:00
Feng Lee
67b7266438 Rename TimerInterval to Interval 2019-06-25 15:58:09 +08:00
Feng Lee
f32a415a83 Merge branch 'channel3' 2019-06-25 15:55:31 +08:00
Feng Lee
4974eab20e Improve the channel design 2019-06-25 14:53:45 +08:00
Feng Lee
c4eb283517 Add spec for validate/1 function 2019-06-25 14:50:51 +08:00
Feng Lee
242a1ae453 Use emqx_mqtt:qos() type 2019-06-25 14:47:42 +08:00
Feng Lee
72331d8ad0 Move emqx_mqtt_types module to emqx_mqtt 2019-06-25 14:46:21 +08:00
Feng Lee
fb54fe0fad Improve export_type attr 2019-06-25 14:45:23 +08:00
Feng Lee
795fe4e0bc Add 'PUBLISH_PACKET(QoS, Topic, PacketId)' macro 2019-06-25 14:29:26 +08:00
Gilbert
475cabde4d Fix issue#2619 (#2646)
* Fix issue#2619
Prior to this change, websocket connection would not be disconnected
when dataframe type is other frametype. However, in mqtt spec, it
shoud be disconnected.

This change fix this inconsistent behaviour with mqtt 5.0
2019-06-21 21:21:49 +08:00
turtled
481458d8ec Add plugin type 2019-06-21 19:52:53 +08:00
tigercl
0c7c4ee417 Using fixed topic for system message of alarm (#2647)
* Using fixed topic for system message of alarm
2019-06-21 19:51:58 +08:00
tigercl
37eef7b72a Add 'auth.mqtt.anonymous' metric (#2631)
* Add 'auth.mqtt.anonymous' metric
2019-06-21 19:21:26 +08:00
Gilbert
138d7727fa
Compact windows platform which has no cpu_sup util function. (#2629)
* Compact windows platform which has no cpu_sup util function.

* Fix wrong os type clause

* Do not start timer when platform is windows
2019-06-20 11:45:44 +08:00
Gilbert
1d23d7de86
Optimize test workflow (#2642)
* Optimize test suites workflow

* Better format of makefile

* Fix protocol suite

* Add emqx_access_SUITE
2019-06-20 11:44:44 +08:00
GilbertWong
bcae452e42 Fix the flapping bug
Prior to this change, the banned until value will not be set
correctly because of wrong spell of config entry name .

This change fix this bug
2019-06-20 10:59:42 +08:00
GilbertWong
ffbb598a73 Increase time precision for emqx_mod_presence 2019-06-20 09:50:05 +08:00
Feng Lee
3877c4db1a Merge branch 'channel2' into channel3 2019-06-18 16:49:26 +08:00
Feng Lee
7774b85f81 Implement the channel architecture 2019-06-18 15:03:51 +08:00
terry-xiaoyu
09dd65b9fa Add logger header validation 2019-06-18 14:37:32 +08:00
terry-xiaoyu
7092748266 Improve log messages using logger header 2019-06-18 14:37:32 +08:00
terry-xiaoyu
c64751a53c Support module level logger header 2019-06-18 14:37:32 +08:00
Feng Lee
21162f88b8 Update copyright 2019-06-18 14:27:06 +08:00
Feng Lee
d065847665 Remove session record 2019-06-16 10:28:23 +08:00
terry-xiaoyu
3f1b788fe8 Remove unused PSK TAB macro 2019-06-14 16:58:46 +08:00
GilbertWong
19822c15bd Add websocket_info to match {stop, Reason} msg 2019-06-14 16:22:57 +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
d3e7d1f0c9 Fix websocket bug (#2615)
Fix websocket bug.

Prior to this change, websocket connection would be closed directly
without sending connack packet when acl check fails.

This change fix this bug.
2019-06-14 11:33:44 +08:00
turtleDeng
a3103cec7b Revert "Fix websocket bug. Prior to this change, websocket connection would be closed directly without sending connack packet when acl check fails."
This reverts commit e73c4c64d0.
2019-06-12 15:51:20 +08:00
GilbertWong
e73c4c64d0 Fix websocket bug.
Prior to this change, websocket connection would be closed directly
without sending connack packet when acl check fails.

This change fix this bug.
2019-06-12 15:49:48 +08:00
turtleDeng
76525cc703
Fix acl deny action logic (#2613) 2019-06-12 15:49:18 +08:00
tigercl
3462bbd619 Fix retain in will message (#2607)
* Fix retain in will message

* Only handle retain available flag in MQTT v5
2019-06-12 15:43:52 +08:00
Feng Lee
de978d4771 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
2019-06-12 10:31:44 +08:00
Feng Lee
d386b27e8a Adopt channel architecture and improve the MQTT frame parser 2019-06-11 23:18:38 +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
turtled
f46205daff Restart mnesia application 2019-06-05 11:50:09 +08:00
Gilbert Wong
f3fcd16dee Fix wrong default value in protocol module 2019-06-03 16:25:04 +08:00
Gilbert Wong
e7cd32edb7 Update esockd deps and fix compile warning 2019-05-31 15:21:59 +08:00
Gilbert Wong
47f9d0e90f Adjust format 2019-05-31 11:16:50 +08:00
Gilbert Wong
365832f945 Use new ranch api to elimate warning log for deprecated apis 2019-05-31 11:16:50 +08:00
Feng Lee
9715234626 Optimize the emqx_zone module using persistent_term
- Don't reload the zone options for updating persistent_term is
expensive
- Use '{?MODULE, Zone, Key}' as the key to avoid name collision
2019-05-31 08:53:42 +08:00
terry-xiaoyu
be7de756c6 Stop alarm before emqx stops 2019-05-28 17:11:31 +08:00
Gilbert
0857b976ed Better zone (#2548) 2019-05-25 22:29:23 +08:00
HeeeJianBo
87ffa77ade Fix lookup_session_pids return data type error 2019-05-25 22:28:34 +08:00
turtled
54f2a768a8 Rm start logger:set_primary_config 2019-05-23 10:51:21 +08:00
Gilbert Wong
1c83270184 Add case clause for emqx_sn and emqx_coap plugin 2019-05-21 11:19:52 +08:00
HeeeJianBo
caa582a028 Revert the PR #2355
- Add anonymous field for credentials
2019-05-15 15:04:27 +08:00
JianBo He
1a92f3259f Enable cert_as_username to pass value to username_as_clientid (#2536) 2019-05-15 10:20:04 +08:00
JianBo He
79c1b7eb78
Put sockname to credentials (#2532)
* Add sockname to credentials

* Explicit credentials type define
2019-05-14 10:22:30 +08:00
JianBo He
97cca1a5ba Set {active, N} for ssl connection (#2531) 2019-05-13 10:18:01 +08:00
turtleDeng
311f1e6df1
Merge pull request #2521 from emqx/develop-3.2 2019-05-09 11:16:14 +08:00
Gilbert Wong
fc6f54602d Fix plugin load bug 2019-05-08 14:23:12 +08:00
tigercl
7e0ac5bd34
Fix bad config type of long_gc (#2504) 2019-05-08 10:19:49 +08:00
terry-xiaoyu
a1eb7ca7d2 Adapt max-heap-size to Arch-32 systems
The erlang:process_flag(max_heap_size, MaxHeapSize) can only set a MaxHeapSize of `small integer`, which is smaller than 2^59 on 64-bit systems, and 2^27 on 32-bit systems.
2019-05-07 17:27:06 +08:00
tigercl
b4c659fb54 Add suboptions for stats (#2507) 2019-05-06 19:17:54 +08:00
Gilbert Wong
3ece73b912 Reuse plugin filter logic to adapt to emqx rebar3 release 2019-05-06 13:34:55 +08:00
turtled
ea83d2087c Optimize log configuration 2019-05-05 14:35:43 +08:00
turtled
c5524e99c6 Rm emqx_rate_limiter module 2019-04-25 14:29:20 +08:00
Gilbert
eaa1deab20 Refactor flapping code (#2476)
* Refactor flapping code
2019-04-24 10:42:26 +08:00
Gilbert Wong
bcbb4b68e9 Add flapping detect feature 2019-04-19 16:34:33 +08:00
Gilbert Wong
5680b191ee Extend status api 2019-04-18 14:12:06 +08:00
Gilbert
94aa173858 Fix bugs of keepalive value init of emqx_client (#2443)
Fix bugs of keepalive value init of emqx_client
2019-04-17 10:43:20 +08:00
Gilbert Wong
f1616c33d9 Convert value of attribute table to map 2019-04-13 10:35:59 +08:00
Gilbert Wong
81ef5b9b8d Support cookie based auth 2019-04-12 19:25:22 +08:00
Gilbert Wong
4d2bc48822 Redesign ensure_start and ensure_stop api of bridge 2019-04-11 18:17:30 +08:00
Gilbert
4fc81cef85
Change log level unexpected info in client (#2422)
Change log level for unexpected info in client and rejust code format in emqx_bridge
2019-04-11 12:20:32 +08:00
周子博
6a4c318acb Update metrics when session process terminates 2019-04-11 10:08:26 +08:00
Shawn
a53320069b Fix trace logger level not work (#2408)
* Fix trace logger level not work #2385
2019-04-10 09:14:53 +08:00
Gilbert Wong
eb7b1797c2 Provide bridge handler to extense emqx_bridge 2019-04-09 19:03:07 +08:00
Gilbert Wong
627ea0afe8 Add is_bridge_exist api in emqx_bridge_sup 2019-04-09 11:40:36 +08:00
Gilbert Wong
8cfd080a97 Fix gen_statem:reply/2 bug in emqx_client module
Prior to this change, the arguments passed to gen_statem:reply is bad
args, first arg should be a tuple, but it is a pid. So it would
trigger crash.

This change fix this bug.
2019-04-08 11:50:28 +08:00
Gilbert Wong
7e6255d4ee Set default websocket idle timeout to 2 hour 2019-04-04 17:42:52 +08:00
Gilbert
e917c025d0
Fix LOG on line 231 2019-04-04 17:38:36 +08:00
JianBo He
aad2d7378e Put peername into messsage headers (#2390)
* Put peername into the message.heaers
2019-04-04 13:41:03 +08:00
Gilbert Wong
287c5582a9 Fix compilation warning 2019-04-03 20:49:45 +08:00
Gilbert Wong
15f8d3208f Fix message dropped
Prior to this change, when store_qos0 option is set to false, the hook
`message.dropped` would not be triggered. It is wrong design and when
the ignore_loop is enabled or nl is set to 1, the hook
`message.dropped` also would not be triggered.
2019-04-03 20:33:58 +08:00
Shawn
2306789755 Remove bin_key_map/1 (#2393)
* Remove bin_key_map/1

* Fix Travis-CI failure
2019-04-03 19:41:21 +08:00
spring2maz
55d2d1d278 Allow boolean flag for loaded plugins
This is to simplify config templating
2019-04-03 19:35:24 +08:00
Feng Lee
60c2b8bc08 Add more functions to read fields of 'message' record
- Add id/1, topic/1, from/1, payload/1 and timestamp/1 functions
- Improve the test cases
2019-04-02 15:15:13 +08:00
HeeeJianBo
2d2520627a Fix topic 'datatype' to 'datetime' 2019-04-01 11:37:22 +08:00
Gilbert Wong
0c64da6da7 Change default log level from info to critical when shutdown 2019-03-29 10:57:52 +08:00
Gilbert
b6fa4d2a3f
Fix bridge subscribe bugs 2019-03-29 10:19:11 +08:00
周子博
f14a56eb17 Fix acl bug in subscribe 2019-03-28 14:04:04 +08:00
Gilbert Wong
114b28f973 Delete function clause which would reply {error,standing_by} 2019-03-28 11:47:29 +08:00
Gilbert
0d6b937127 Support proxy protocol of websocket (#2372)
Support proxy protocol of websocket
2019-03-28 10:34:48 +08:00
HeeeJianBo
24f8c3a391 Fix drain the session process mailbox handling err 2019-03-28 10:32:03 +08:00
周子博
6e3c4b0855 Fix conflict 2019-03-27 13:59:26 +08:00
Shawn
a3fd8846a5
Bin key map (#2362)
Suppport nested bin-key map
2019-03-27 11:12:28 +08:00
turtleDeng
e6d90d5758
Improve mountpoint (#2363) 2019-03-27 11:10:51 +08:00
周子博
0fbf771543 Readjust log level into error when got unexpected message 2019-03-27 11:07:58 +08:00
JianBo He
c223f62c5a Put cn/dn of client cert into credentials (#2357)
Put cn/dn of client cert into credentials
2019-03-27 10:20:12 +08:00
Gilbert
2534b8dc64 Support to pass ws compressing options (#2356)
Add new config entries about websocket
2019-03-27 10:19:35 +08:00
tigercl
f5c426a2f2
Add missed case for monitors (#2353) 2019-03-27 10:18:51 +08:00
周子博
58e1b4d485 Readjust log level and unify log format 2019-03-26 22:18:31 +08:00
Shawn
f0fa9a9252 Add a function converting message to binary-key map (#2360) 2019-03-26 10:35:10 +08:00
JianBo He
8d92d58b6c Fix allow_anonymous behavoir error (#2355)
EMQ should allow the anonymous connection if the allow_anonymous option is true, although it has one or more auth plugins started.
2019-03-26 10:25:51 +08:00
Shawn
9e7b3a9209
Update emqx_types.erl 2019-03-22 16:27:23 +08:00
terry-xiaoyu
bd304572c9 Delete acl_mod and auth_mod 2019-03-22 16:18:42 +08:00
terry-xiaoyu
c7a317afaf Add one more connack reason code 2019-03-22 15:43:21 +08:00
HeeeJianBo
fc2df9aff5 Adapt to new export style 2019-03-22 14:58:24 +08:00
Gilbert
e386778aca Fix typo 2019-03-22 11:31:26 +08:00
Feng Lee
dba16aeea5 Add 'remove_header/2', 'get_headers/1' functions
- Adopt new 'export' style
- Add 'remove_header/2', 'get_headers/1' functions
- Remove 'remove_topic_alias/1' function
2019-03-22 11:31:26 +08:00
Feng Lee
ba719a896d Call 'tokens/1' instead of 'words/1' 2019-03-22 11:31:26 +08:00
Feng Lee
a4550a8fc4 Add emqx_topic:tokens/1 function 2019-03-22 11:31:26 +08:00
JianBo He
513d2bcaaa Fix reload ACL failed (#2344)
The original `reload_acl` function only parse the ACL file, not compile and rehook to 'client.check_acl'
2019-03-22 10:21:16 +08:00
turtled
416bc75d5d Sort plugin list 2019-03-22 01:02:30 +08:00
turtled
865ef864db Get the plugins list through -emqx_plugin module attributes 2019-03-22 00:03:53 +08:00
terry-xiaoyu
b79bf13ae7 Rename result -> auth_result 2019-03-22 00:03:34 +08:00
HeeeJianBo
998684fc4e Fix badmatch error in the batch_process of session 2019-03-21 17:40:02 +08:00
terry-xiaoyu
36927f01e7 Add type definition for auth_result 2019-03-21 16:54:50 +08:00
tigercl
e7320620c0 Fix alarm report bug (#2332) 2019-03-21 16:53:46 +08:00
linjun
3a2f6d5a6c Fix badmatch bug for reload_acl 2019-03-21 16:51:57 +08:00
tigercl
5a401c44fd Clear dup flag if message published first (#2337) 2019-03-21 10:13:41 +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
turtleDeng
a95ebcd7d6
Fix typo 2019-03-17 00:23:44 +08:00
YoukiLin
88c32b2c41 Fix emqx_rpc badargs bug 2019-03-16 21:27:41 +08:00
Gilbert Wong
763115e149 Delegate serialize fun into sendfun 2019-03-16 21:15:10 +08:00
spring2maz
a72a914fb8 Fix issue #2312 (#2313)
* Fix SSL option parser

* Fix bridge disconnect log formatting

* Set no headers if new headers is undefined
2019-03-16 19:28:57 +08:00
YoukiLin
29f4faa7dd Add badtcp clause to handle gen_rpc (#2314) 2019-03-16 18:23:18 +08:00
terry-xiaoyu
901bbdedd6 Add some auth error codes 2019-03-16 16:30:25 +08:00
terry-xiaoyu
749494c277 Change default internal-rules to #{} 2019-03-16 13:08:11 +08:00
terry-xiaoyu
2912d9a41b Rename is_super -> is_superuser 2019-03-16 12:51:45 +08:00
terry-xiaoyu
a7adb79f17 Allow empty zone in credentials 2019-03-16 12:25:39 +08:00
Shawn
02fe8560e2
Improve emqx_hooks and credentials (#2309)
* Improve emqx_hooks and credentials

1. Modify the return modes of emqx hooks.

Change the return value of hook functions to:
- ok: stop the hook chain and return ok
- {error, Reason}: stop the hook chain and return error
- continue: continue the hook chain

And the return value of emqx_hooks:run/2 is changed to:
- ok
- {error, Reason}

And the return value of emqx_hooks:run/3:
- {ok, Acc}
- {error, Reason, Acc}

2. Treat password as a member of credentials.

Password should be wrapped in the `credentials` data-structure, as the
username/password pair together consists of an authentication method.
There can be some methods using some other credential data (e.g.
a JWT token), and these credential data should also be wrapped in the
the `credentials` data-structure.

An event `client.authenticate` is triggered when an user logs in:
```erlang
emqx_hooks:run('client.authenticate', [], Credentials)
```

A `default callback` that deny/allow any user (according to the
`allow_anonymous` config) should be appended to the end of the
callback chain.

The `credentails` is passed through all of the callbacks, and
can be changed over in this process.

* Refactor emqx hooks return mode

* Remove password from PState
2019-03-16 10:43:53 +08:00
spring2maz
f2df92fef2 Unload emqx_alarm_handler before unloading plugins when shuting down (#2316)
emqx_alarm_handler publishes mqtt messages,
having it running while plugins are shutdown triggered some
annoying crashes
2019-03-15 17:11:24 +08:00
Feng Lee
56718e35cb Add emqx_topic:tokens/1 function (#2305)
* Add emqx_topic:tokens/1 function
2019-03-13 23:31:44 +08:00
Shawn
111b66121c
Support TLS/DTLS PSK (#2297)
* Improve filter functions for emqx-hook

* Add PSK hook

* Reset hook args for filter functions
2019-03-13 22:24:19 +08:00
spring2maz
48450d1d37 Move request response out of emqx client (#2293)
* Delete response_topic_prefix

The Response-Infomation in CONNACK was misinterpreated, it should
not be a broker's global config, instead, it should be per-client
or even per-session prefix/suffix mechanism

* Delete request-response code from emqx_client

* Add request-response test code

* meck as default dependency --- temp workaround for dep-vsn-check
2019-03-13 11:27:25 +08:00
turtled
b51747f03e Export find_plugin 2019-03-12 22:45:50 +08:00
linjun
f166b81702 Use broker_sys_interval instead of sys_interval 2019-03-12 10:15:13 +08:00
spring2maz
252b376e48 Use keep_state_and_data in emqx_client to avoid unnecessary var binding 2019-03-05 04:04:20 +01:00
spring2maz
656429fcc1 Move emqx_client should_ping function to internal block 2019-03-05 03:57:20 +01:00
spring2maz
a056a4cbde Eliminate {error, inflight_full} from publish call to emqx_client
Prior to this change, if a emqx_client:publish/? caller sends in
QoS=1/2 messages too fast, emqx_client may return
`{error, inflight_full}` which could put put the caller to an
awkward situation: there seem to be no ohter option except for
putting self to a sleep-n-retry infinite loop.

In this change, a new gen_statm state 'inflight_full' is introduced
as a sub-state of 'connected'. When emqx_client is in 'inflight_full'
state, it postpone all publish calls (for QoS=1/2) until inflight
window size shrinks.
2019-03-05 03:47:33 +01:00
turtled
22aa7d4668 Rm acl_deny_action_ct test case 2019-02-28 22:19:19 +08:00
tigercl
da755b88c7 Add monitors and alarm handler (#2266)
* Add monitors and alarm handler
2019-02-28 18:25:17 +08:00
turtled
f1d751dd95 Fix compile fail 2019-02-28 17:06:40 +08:00
Gilbert
b1ca0120a2 Move bridge modules out of bridge directory (#2273) 2019-02-28 17:04:39 +08:00
turtled
c8e2840126 Merge fix conflicts 2019-02-28 17:02:39 +08:00
turtled
42932d7b5d Format code 2019-02-28 16:57:40 +08:00
turtled
df97eb0007 Review code 2019-02-28 16:56:44 +08:00
turtled
8792f7e02b Review code 2019-02-28 16:56:04 +08:00
linjun
814fd3fc9e Fix test case 2019-02-28 16:36:47 +08:00
Gilbert Wong
055d0ad98e Fix typo 2019-02-28 15:39:11 +08:00
Gilbert Wong
7efd7b3ec0 Rename portal to bridge 2019-02-28 15:31:54 +08:00
Gilbert
771f8c052a
Merge branch 'develop' into introduce-new-bridge-impl 2019-02-28 15:14:40 +08:00
Feng Lee
3e0fa87209 Remove the io:format 2019-02-28 15:09:13 +08:00
Feng Lee
e3bc8e4f0a Support batch delivery
- Upgrade the emqx_session module to support batch delivery
- Update emqx_protocol:deliver/2 to support batch delivery
- Update some test cases
2019-02-28 15:09:13 +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
Gilbert Wong
d18f4ba550 Fix wrong config entries 2019-02-28 11:18:12 +08:00
Gilbert Wong
911a813891 Fix copyright and unify log method 2019-02-28 11:18:12 +08:00
spring2maz
9dbc34c376 Ack replayq and allow retry in tests 2019-02-28 11:17:27 +08:00
Gilbert Wong
75163e21f3 Reverse intensity/period in bridge SupFlag 2019-02-28 11:17:27 +08:00
Gilbert Wong
ae92acf30f Refactor portal supervisor 2019-02-28 11:17:27 +08:00
Gilbert Wong
ec37225333 Add emqx_portal interfaces 2019-02-28 11:17:27 +08:00
Gilbert Wong
921a45a505 Fix emqx_portal_mqtt_tests start function 2019-02-28 11:17:27 +08:00
spring2maz
d4495fd8e7 Add manual start API 2019-02-28 11:17:27 +08:00
spring2maz
1626cade28 Deleted batch publish support in emqx_portal_client
eqmx_portal_mqtt has to do single message publish calls for now
Also fix a bug in emqx_portal_mqtt ack collector
2019-02-28 11:17:27 +08:00
spring2maz
086a1d56b9 Drop unused config schema
bridge.$name.transport was added before we decided to derive
transport portocol based on the 'address' config.
i.e. when it's a remote erlang node, use gen_rpc
otherwise (must be IP or hostnmae), we should estabilish mqtt connection
2019-02-28 11:17:27 +08:00
spring2maz
efc9e34033 Make use of BUMP_PACKET_ID the only way to generate packet IDs 2019-02-28 11:17:27 +08:00
Gilbert Wong
d7e18c95c6 Fix spelling error 2019-02-28 11:17:27 +08:00
spring2maz
786a6eb696 Add APIs for subscription add / delete 2019-02-28 11:17:27 +08:00
spring2maz
599f5c8d4f Add API emqx_portal:ensure_forward_absent 2019-02-28 11:17:27 +08:00
spring2maz
2903a810ce Add emqx_portal:ensure_foreard_present API 2019-02-28 11:17:27 +08:00
spring2maz
9e78c18681 Add get_forwards and get_subscriptions protal APIs 2019-02-28 11:17:27 +08:00
spring2maz
67376727c9 Add batch send support for emqx_client:publish/2
also cover emqx_portal_mqtt with CT
2019-02-28 11:17:27 +08:00
spring2maz
b9e8bde3b0 Add first CT test for emqx_portal based on rpc 2019-02-28 11:17:27 +08:00
spring2maz
6d51d78dfc Add portal transport over emqx_client. 2019-02-28 11:17:27 +08:00
spring2maz
141af0d02c Add message handler callbacks option to emqx_client
In this commit, msg_handler option is added to emqx_client.
so the caller can provide callbacks to handle puback, publish,
as well as disconnected events instead of always delivered
as message like Owner ! {publish, Msg} to the owner process.

This is to make it ready to implement emqx_portal_connect on
top of emqx_client.
2019-02-28 11:17:27 +08:00
spring2maz
fbe67e6784 Introduce new bridge impl 2019-02-28 11:17:27 +08:00
Gilbert
c3e6f3c3b2 Improve try catch syntax (#2263)
* Replace case catch.. with try ... catch
Prior to this change, case catch ... would cost a lot of performance
because it would retrieve the whole stacktrace. However, try...catch
will not retrieve the whole stacktrace. So try...catch syntax is better.
2019-02-28 09:54:28 +08:00
linjun
44529a278d Adjusting code 2019-02-27 14:39:49 +08:00
linjun
e1a5188d09 Adjusting code 2019-02-27 14:00:11 +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
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
Feng Lee
565c1a8c85 Optimize unset_flag/2 and add some specs
- Optimize unset_flag/2
- Add some function specs
- Add emqx_message_SUITE to Makefile
2019-02-22 17:06:52 +08:00
Feng Lee
82c337a040 Fix 'drpped' typo
- Fix 'drpped' typo
- Add specs for exported functions
- Add 'group()' type in emqx_topic module
2019-02-22 10:03:29 +08:00
Feng Lee
7a645dd9cc Add 'include/types.hrl' and introduce some common types 2019-02-19 17:16:11 +08:00
张奇怪
44d3eff094 Auto-pull-request-by-2019-02-19 (#2232)
* Update Copyright to 2019 (#2191)

* Disable bridges by default (#2189)

* Fix warning logger args emqx#2195

* Ambiguity elimination (#2217)

* Fix emqx_ws_connection: prevent crashes on pong (#2210)

* Issue#2184 (#2194)

* Delete dep-vsn-check

* Format app.src
2019-02-19 14:00:34 +08:00
turtled
31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
turtleDeng
00863acea3
Merge emqx30 (#2181)
* Change the reason code in will topic acl check (#2168)

* Fix bridge bug (#2160)

* Limit bridge QoS less than 1

* Improve shared sub dispatch implementation. (#2144)

* Upgrade ekka, esockd libraries

* Improve the 'try_open_session' function

* Reload config (#2180)
2019-01-25 13:01:48 +08:00
Shawn
b8929a46c1 Fix the EXIT outputs in Travis CI (#2154)
* Fix the Exit in testcases

* Fix Exit in emqx_mod_sup_SUITE

* Update testcases for log_tracer

* Fix Exit in emqx_protocol_SUITE

* Add will_acl_check

* Fix more Exits
2019-01-17 17:14:51 +08:00
tigercl
bc31faac6b Fix will msg (#2156)
* Remove will_msg and will_topic from protocol state

* Modify try_open_session/1
2019-01-17 13:57:42 +08:00
Gilbert Wong
ec03f8e1fa Fix the deliver packet bug and add test case 2019-01-11 16:41:20 +08:00
turtleDeng
a5f9466040 QoS0 msg support msgid (#2145)
* QoS0 msg support msgid

* Fix testcase
2019-01-11 11:47:10 +08:00
Feng Lee
5ccaaed34c Add 'next_events/1' and fix the 'process_incoming/3' function 2019-01-10 09:23:05 +08:00
Feng Lee
3e15ac0bbb Improve the design of 'emqx_client' module
Use '{next_event, cast, Packet}' to replace 'gen_statem:cast/2'
2019-01-10 09:23:05 +08:00
Feng Lee
30f32de13a Use map to replace 'state' record 2019-01-10 08:53:10 +08:00
Feng Lee
e882af9369 Use the new logger macros 2019-01-10 08:53:10 +08:00
Feng Lee
fe0f5333b3 Improve the pool design
- Move 'emqx_pool:start_link/0' to emqx_pool_sup module
- Use the new log macros
- Add more test cases
2019-01-10 08:49:58 +08:00
Feng Lee
4230a3c535 Optimize the trie match 2019-01-09 11:57:22 +08:00
Feng Lee
0c418581b2 Add emqx_trie:empty/0 and optimize match_routes/1 2019-01-09 11:57:22 +08:00
Gilbert
dee88fb018 Fix mem cache bug (#2129) 2019-01-07 14:15:27 +08:00
Shawn
0d9929fdaa Logger level in one command (#2115)
* Refactor logger-level-in-one-command

* Update API
2019-01-07 11:40:54 +08:00