EMQX 3.0 UT
This commit is contained in:
parent
47232d0281
commit
c967db409f
|
@ -373,12 +373,22 @@ init([Options]) ->
|
||||||
{_ver, undefined} -> random_client_id();
|
{_ver, undefined} -> random_client_id();
|
||||||
{_ver, Id} -> iolist_to_binary(Id)
|
{_ver, Id} -> iolist_to_binary(Id)
|
||||||
end,
|
end,
|
||||||
|
Username = case proplists:get_value(username, Options) of
|
||||||
|
undefined -> <<>>;
|
||||||
|
Name -> Name
|
||||||
|
end,
|
||||||
|
Password = case proplists:get_value(password, Options) of
|
||||||
|
undefined -> <<>>;
|
||||||
|
Passw -> Passw
|
||||||
|
end,
|
||||||
State = init(Options, #state{host = {127,0,0,1},
|
State = init(Options, #state{host = {127,0,0,1},
|
||||||
port = 1883,
|
port = 1883,
|
||||||
hosts = [],
|
hosts = [],
|
||||||
sock_opts = [],
|
sock_opts = [],
|
||||||
bridge_mode = false,
|
bridge_mode = false,
|
||||||
client_id = ClientId,
|
client_id = ClientId,
|
||||||
|
username = Username,
|
||||||
|
password = Password,
|
||||||
clean_start = true,
|
clean_start = true,
|
||||||
proto_ver = ?MQTT_PROTO_V4,
|
proto_ver = ?MQTT_PROTO_V4,
|
||||||
proto_name = <<"MQTT">>,
|
proto_name = <<"MQTT">>,
|
||||||
|
@ -542,7 +552,8 @@ mqtt_connect(State = #state{client_id = ClientId,
|
||||||
properties = Properties}) ->
|
properties = Properties}) ->
|
||||||
?WILL_MSG(WillQoS, WillRetain, WillTopic, WillProps, WillPayload) = WillMsg,
|
?WILL_MSG(WillQoS, WillRetain, WillTopic, WillProps, WillPayload) = WillMsg,
|
||||||
ConnProps = emqx_mqtt_properties:filter(?CONNECT, Properties),
|
ConnProps = emqx_mqtt_properties:filter(?CONNECT, Properties),
|
||||||
io:format("ConnProps: ~p~n", [ConnProps]),
|
io:format("ConnProps: ~p, ClientID: ~p, Username: ~p, Password: ~p~n",
|
||||||
|
[ConnProps, ClientId, Username, Password]),
|
||||||
send(?CONNECT_PACKET(
|
send(?CONNECT_PACKET(
|
||||||
#mqtt_packet_connect{proto_ver = ProtoVer,
|
#mqtt_packet_connect{proto_ver = ProtoVer,
|
||||||
proto_name = ProtoName,
|
proto_name = ProtoName,
|
||||||
|
@ -1082,4 +1093,3 @@ next_packet_id(State = #state{last_packet_id = 16#ffff}) ->
|
||||||
|
|
||||||
next_packet_id(State = #state{last_packet_id = Id}) ->
|
next_packet_id(State = #state{last_packet_id = Id}) ->
|
||||||
State#state{last_packet_id = Id + 1}.
|
State#state{last_packet_id = Id + 1}.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue