Merge pull request #3479 from emqx/master
This commit is contained in:
commit
2ac50dcfd0
|
@ -1,7 +1,7 @@
|
||||||
# Configuration for weekly-digest - https://github.com/apps/weekly-digest
|
# Configuration for weekly-digest - https://github.com/apps/weekly-digest
|
||||||
publishDay: sun
|
publishDay: monday
|
||||||
canPublishIssues: true
|
canPublishIssues: true
|
||||||
canPublishPullRequests: true
|
canPublishPullRequests: true
|
||||||
canPublishContributors: true
|
canPublishContributors: true
|
||||||
canPublishStargazers: true
|
canPublishStargazers: true
|
||||||
canPublishCommits: true
|
canPublishCommits: true
|
||||||
|
|
|
@ -15,8 +15,12 @@ jobs:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
|
make xref
|
||||||
|
rm -f rebar.lock
|
||||||
make eunit
|
make eunit
|
||||||
|
rm -f rebar.lock
|
||||||
make ct
|
make ct
|
||||||
|
rm -f rebar.lock
|
||||||
make cover
|
make cover
|
||||||
- name: Coveralls
|
- name: Coveralls
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.4"}}},
|
{jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.4"}}},
|
||||||
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.7.1"}}},
|
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.7.1"}}},
|
||||||
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.6.1"}}},
|
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.6.1"}}},
|
||||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.7.2"}}},
|
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.7.3"}}},
|
||||||
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.4.1"}}},
|
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.4.1"}}},
|
||||||
{cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}}
|
{cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}}
|
||||||
]}.
|
]}.
|
||||||
|
|
|
@ -250,8 +250,10 @@ handle_in(Packet = ?AUTH_PACKET(?RC_CONTINUE_AUTHENTICATION, _Properties), Chann
|
||||||
case ConnState of
|
case ConnState of
|
||||||
connecting ->
|
connecting ->
|
||||||
process_connect(NProperties, ensure_connected(NChannel));
|
process_connect(NProperties, ensure_connected(NChannel));
|
||||||
|
connected ->
|
||||||
|
handle_out(auth, {?RC_SUCCESS, NProperties}, NChannel);
|
||||||
_ ->
|
_ ->
|
||||||
handle_out(auth, {?RC_SUCCESS, NProperties}, NChannel)
|
handle_out(disconnect, ?RC_PROTOCOL_ERROR, Channel)
|
||||||
end;
|
end;
|
||||||
{continue, NProperties, NChannel} ->
|
{continue, NProperties, NChannel} ->
|
||||||
handle_out(auth, {?RC_CONTINUE_AUTHENTICATION, NProperties}, NChannel);
|
handle_out(auth, {?RC_CONTINUE_AUTHENTICATION, NProperties}, NChannel);
|
||||||
|
@ -259,7 +261,7 @@ handle_in(Packet = ?AUTH_PACKET(?RC_CONTINUE_AUTHENTICATION, _Properties), Chann
|
||||||
handle_out(connack, NReasonCode, NChannel)
|
handle_out(connack, NReasonCode, NChannel)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
handle_in(Packet = ?AUTH_PACKET(?RC_RE_AUTHENTICATE, _Properties), Channel) ->
|
handle_in(Packet = ?AUTH_PACKET(?RC_RE_AUTHENTICATE, _Properties), Channel = #channel{conn_state = connected}) ->
|
||||||
case enhanced_auth(Packet, Channel) of
|
case enhanced_auth(Packet, Channel) of
|
||||||
{ok, NProperties, NChannel} ->
|
{ok, NProperties, NChannel} ->
|
||||||
handle_out(auth, {?RC_SUCCESS, NProperties}, NChannel);
|
handle_out(auth, {?RC_SUCCESS, NProperties}, NChannel);
|
||||||
|
@ -269,6 +271,9 @@ handle_in(Packet = ?AUTH_PACKET(?RC_RE_AUTHENTICATE, _Properties), Channel) ->
|
||||||
handle_out(disconnect, NReasonCode, NChannel)
|
handle_out(disconnect, NReasonCode, NChannel)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
handle_in(?PACKET(_), Channel = #channel{conn_state = ConnState}) when ConnState =/= connected ->
|
||||||
|
handle_out(disconnect, ?RC_PROTOCOL_ERROR, Channel);
|
||||||
|
|
||||||
handle_in(Packet = ?PUBLISH_PACKET(_QoS), Channel) ->
|
handle_in(Packet = ?PUBLISH_PACKET(_QoS), Channel) ->
|
||||||
case emqx_packet:check(Packet) of
|
case emqx_packet:check(Packet) of
|
||||||
ok -> process_publish(Packet, Channel);
|
ok -> process_publish(Packet, Channel);
|
||||||
|
|
|
@ -125,9 +125,15 @@ get_commands() ->
|
||||||
[{Cmd, M, F} || {{_Seq, Cmd}, {M, F}, _Opts} <- ets:tab2list(?CMD_TAB)].
|
[{Cmd, M, F} || {{_Seq, Cmd}, {M, F}, _Opts} <- ets:tab2list(?CMD_TAB)].
|
||||||
|
|
||||||
help() ->
|
help() ->
|
||||||
print("Usage: ~s~n", [?MODULE]),
|
case ets:tab2list(?CMD_TAB) of
|
||||||
[begin print("~110..-s~n", [""]), Mod:Cmd(usage) end
|
[] ->
|
||||||
|| {_, {Mod, Cmd}, _} <- ets:tab2list(?CMD_TAB)].
|
print("No commands available.~n");
|
||||||
|
Cmds ->
|
||||||
|
print("Usage: ~s~n", [?MODULE]),
|
||||||
|
lists:foreach(fun({_, {Mod, Cmd}, _}) ->
|
||||||
|
print("~110..-s~n", [""]), Mod:Cmd(usage)
|
||||||
|
end, Cmds)
|
||||||
|
end.
|
||||||
|
|
||||||
-spec(print(io:format()) -> ok).
|
-spec(print(io:format()) -> ok).
|
||||||
print(Msg) ->
|
print(Msg) ->
|
||||||
|
|
|
@ -112,6 +112,12 @@ t_handle_in_unexpected_connect_packet(_) ->
|
||||||
{ok, [{outgoing, Packet}, {close, protocol_error}], Channel} =
|
{ok, [{outgoing, Packet}, {close, protocol_error}], Channel} =
|
||||||
emqx_channel:handle_in(?CONNECT_PACKET(connpkt()), Channel).
|
emqx_channel:handle_in(?CONNECT_PACKET(connpkt()), Channel).
|
||||||
|
|
||||||
|
t_handle_in_unexpected_packet(_) ->
|
||||||
|
Channel = emqx_channel:set_field(conn_state, idle, channel()),
|
||||||
|
Packet = ?DISCONNECT_PACKET(?RC_PROTOCOL_ERROR),
|
||||||
|
{ok, [{outgoing, Packet}, {close, protocol_error}], Channel} =
|
||||||
|
emqx_channel:handle_in(?PUBLISH_PACKET(?QOS_0), Channel).
|
||||||
|
|
||||||
t_handle_in_connect_auth_failed(_) ->
|
t_handle_in_connect_auth_failed(_) ->
|
||||||
ConnPkt = #mqtt_packet_connect{
|
ConnPkt = #mqtt_packet_connect{
|
||||||
proto_name = <<"MQTT">>,
|
proto_name = <<"MQTT">>,
|
||||||
|
|
Loading…
Reference in New Issue