Merge branch 'dev' of github.com:emqtt/emqtt into dev
This commit is contained in:
commit
c34eaddcc7
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "tests/org.eclipse.paho.mqtt.testing"]
|
||||||
|
path = tests/org.eclipse.paho.mqtt.testing
|
||||||
|
url = git://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.testing.git
|
|
@ -90,9 +90,11 @@ handle_cast(Msg, State) ->
|
||||||
handle_info(timeout, State) ->
|
handle_info(timeout, State) ->
|
||||||
stop({shutdown, timeout}, State);
|
stop({shutdown, timeout}, State);
|
||||||
|
|
||||||
handle_info({stop, duplicate_id}, State=#state{conn_name=ConnName}) ->
|
handle_info({stop, duplicate_id, NewPid}, State=#state{conn_name=ConnName}) ->
|
||||||
%%TODO:
|
%% TODO: to...
|
||||||
%lager:error("Shutdown for duplicate clientid:~s, conn:~s", [ClientId, ConnName]),
|
%% need transfer data???
|
||||||
|
%% emqtt_client:transfer(NewPid, Data),
|
||||||
|
%% lager:error("Shutdown for duplicate clientid:~s, conn:~s", [ClientId, ConnName]),
|
||||||
stop({shutdown, duplicate_id}, State);
|
stop({shutdown, duplicate_id}, State);
|
||||||
|
|
||||||
%%TODO: ok??
|
%%TODO: ok??
|
||||||
|
|
|
@ -119,6 +119,7 @@ parse_frame(Bin, #mqtt_packet_header{ type = Type,
|
||||||
<<PacketId:16/big>> = FrameBin,
|
<<PacketId:16/big>> = FrameBin,
|
||||||
wrap(Header, #mqtt_packet_puback{packet_id = PacketId}, Rest);
|
wrap(Header, #mqtt_packet_puback{packet_id = PacketId}, Rest);
|
||||||
{?PUBREL, <<FrameBin:Length/binary, Rest/binary>>} ->
|
{?PUBREL, <<FrameBin:Length/binary, Rest/binary>>} ->
|
||||||
|
1 = Qos,
|
||||||
<<PacketId:16/big>> = FrameBin,
|
<<PacketId:16/big>> = FrameBin,
|
||||||
wrap(Header, #mqtt_packet_puback{ packet_id = PacketId }, Rest);
|
wrap(Header, #mqtt_packet_puback{ packet_id = PacketId }, Rest);
|
||||||
{?PUBCOMP, <<FrameBin:Length/binary, Rest/binary>>} ->
|
{?PUBCOMP, <<FrameBin:Length/binary, Rest/binary>>} ->
|
||||||
|
|
|
@ -229,10 +229,15 @@ handle_packet(?DISCONNECT, #mqtt_packet{}, State=#proto_state{peer_name = PeerNa
|
||||||
make_packet(Type) when Type >= ?CONNECT andalso Type =< ?DISCONNECT ->
|
make_packet(Type) when Type >= ?CONNECT andalso Type =< ?DISCONNECT ->
|
||||||
#mqtt_packet{ header = #mqtt_packet_header { type = Type } }.
|
#mqtt_packet{ header = #mqtt_packet_header { type = Type } }.
|
||||||
|
|
||||||
make_packet(PubAck, PacketId) when PubAck >= ?PUBACK andalso PubAck =< ?PUBREC ->
|
make_packet(PubAck, PacketId) when PubAck >= ?PUBACK andalso PubAck =< ?PUBCOMP ->
|
||||||
#mqtt_packet { header = #mqtt_packet_header { type = PubAck},
|
#mqtt_packet { header = #mqtt_packet_header { type = PubAck, qos = puback_qos(PubAck) },
|
||||||
variable = #mqtt_packet_puback { packet_id = PacketId}}.
|
variable = #mqtt_packet_puback { packet_id = PacketId}}.
|
||||||
|
|
||||||
|
puback_qos(?PUBACK) -> ?QOS_0;
|
||||||
|
puback_qos(?PUBREC) -> ?QOS_0;
|
||||||
|
puback_qos(?PUBREL) -> ?QOS_1;
|
||||||
|
puback_qos(?PUBCOMP) -> ?QOS_0.
|
||||||
|
|
||||||
-spec send_message(Message, State) -> {ok, NewState} when
|
-spec send_message(Message, State) -> {ok, NewState} when
|
||||||
Message :: mqtt_message(),
|
Message :: mqtt_message(),
|
||||||
State :: proto_state(),
|
State :: proto_state(),
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 17afdf7fb8e148f376d63592bbf3dd4ccdf19e84
|
Loading…
Reference in New Issue