Commit Graph

3463 Commits

Author SHA1 Message Date
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
Gilbert Wong
d020ac0390 Delay receive waiting time 2019-03-18 14:20:52 +08:00
turtleDeng
a95ebcd7d6
Fix typo 2019-03-17 00:23:44 +08:00
Gilbert Wong
7ff56b55f0 Force makefile to git clone deps 2019-03-16 23:05:15 +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
turtleDeng
b902ff3656 Update gen_rpc to v2.3.1 (#2315)
Update gen_rpc to v2.3.1
2019-03-15 10:30:14 +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
Gilbert Wong
27a7105fac Fix emqx_alarm_handler_SUITE
Prior to this change, emqx_alarm_handler_SUITE read emqx.conf rather
gen.emqx.conf which would trigger unexpected errors

This change fix this issue.
2019-03-13 10:52:15 +08:00
Gilbert Wong
076f3e3068 Fix schema bug 2019-03-13 10:14:31 +08:00
turtled
b51747f03e Export find_plugin 2019-03-12 22:45:50 +08:00
周子博
6816c1ac3e Delete needless test case in emqx_protocol_SUITE 2019-03-12 10:17:22 +08:00
linjun
f166b81702 Use broker_sys_interval instead of sys_interval 2019-03-12 10:15:13 +08:00
Gilbert
93162c52b6
Fix conf parse bug (#2296)
Prior to this change, there are some config entry which is not parsed
correctly. So if user modify config such as reconnect_interval for
bridge, the new config can not be taken into effect.
2019-03-11 16:31:21 +08:00
spring2maz
ad74772191
Merge pull request #2281 from emqx/eliminate-inflight-full-error
Eliminate inflight full error
2019-03-09 09:07:12 +01:00
spring2maz
1e27098e8c Drain msg queue for deterministic test 2019-03-05 04:28:01 +01: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
Gilbert
c26d13b057 Fix test case (#2275)
* Fix t_rpc test
2019-02-28 18:07:16 +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
ebc442bb39
Introduce new bridge impl 2019-02-28 15:48:35 +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
37c7e684b0 Adjusting code 2019-02-28 14:32:13 +08:00
linjun
16165ce935 Use conn_mod instead of socktype 2019-02-28 11:32:05 +08:00