fix reason code name for mqtt 4
This commit is contained in:
parent
cae673cf5e
commit
2fc41b6935
|
@ -592,8 +592,8 @@ waiting_for_connack(cast, ?CONNACK_PACKET(?RC_SUCCESS,
|
|||
|
||||
waiting_for_connack(cast, ?CONNACK_PACKET(ReasonCode,
|
||||
_SessPresent,
|
||||
Properties), State) ->
|
||||
Reason = emqx_reason_codes:name(ReasonCode),
|
||||
Properties), State = #state{ proto_ver = ProtoVer}) ->
|
||||
Reason = emqx_reason_codes:name(ReasonCode, ProtoVer),
|
||||
case take_call(connect, State) of
|
||||
{value, #call{from = From}, _State} ->
|
||||
Reply = {error, {Reason, Properties}},
|
||||
|
@ -1082,6 +1082,7 @@ receive_loop(Bytes, State = #state{parse_state = ParseState}) ->
|
|||
{error, Reason} ->
|
||||
{stop, Reason};
|
||||
{'EXIT', Error} ->
|
||||
io:format("client stop"),
|
||||
{stop, Error}
|
||||
end.
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ connack({ReasonCode, PState = #pstate{proto_ver = ProtoVer}}) ->
|
|||
true ->
|
||||
emqx_reason_codes:compat(connack, ReasonCode)
|
||||
end}, PState),
|
||||
{error, emqx_reason_codes:name(ReasonCode), PState}.
|
||||
{error, emqx_reason_codes:name(ReasonCode, ProtoVer), PState}.
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% Publish Message -> Broker
|
||||
|
|
|
@ -17,9 +17,18 @@
|
|||
|
||||
-include("emqx_mqtt.hrl").
|
||||
|
||||
-export([name/1, text/1]).
|
||||
-export([name/2, text/1]).
|
||||
-export([compat/2]).
|
||||
|
||||
name(I, Ver) when Ver >= ?MQTT_PROTO_V5 ->
|
||||
name(I);
|
||||
name(0, _Ver) -> connection_acceptd;
|
||||
name(1, _Ver) -> unacceptable_protocol_version;
|
||||
name(2, _Ver) -> client_identifier_not_valid;
|
||||
name(3, _Ver) -> server_unavaliable;
|
||||
name(4, _Ver) -> malformed_username_or_password;
|
||||
name(5, _Ver) -> unauthorized_client.
|
||||
|
||||
name(16#00) -> success;
|
||||
name(16#01) -> granted_qos1;
|
||||
name(16#02) -> granted_qos2;
|
||||
|
|
Loading…
Reference in New Issue