Merge branch 'dev' of github.com:emqtt/emqtt into dev

This commit is contained in:
Feng Lee 2015-01-12 12:57:39 +08:00
commit c34eaddcc7
6 changed files with 17 additions and 5 deletions

3
.gitmodules vendored Normal file
View File

@ -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

View File

@ -90,9 +90,11 @@ handle_cast(Msg, State) ->
handle_info(timeout, State) ->
stop({shutdown, timeout}, State);
handle_info({stop, duplicate_id}, State=#state{conn_name=ConnName}) ->
%%TODO:
%lager:error("Shutdown for duplicate clientid:~s, conn:~s", [ClientId, ConnName]),
handle_info({stop, duplicate_id, NewPid}, State=#state{conn_name=ConnName}) ->
%% TODO: to...
%% need transfer data???
%% emqtt_client:transfer(NewPid, Data),
%% lager:error("Shutdown for duplicate clientid:~s, conn:~s", [ClientId, ConnName]),
stop({shutdown, duplicate_id}, State);
%%TODO: ok??

View File

@ -119,6 +119,7 @@ parse_frame(Bin, #mqtt_packet_header{ type = Type,
<<PacketId:16/big>> = FrameBin,
wrap(Header, #mqtt_packet_puback{packet_id = PacketId}, Rest);
{?PUBREL, <<FrameBin:Length/binary, Rest/binary>>} ->
1 = Qos,
<<PacketId:16/big>> = FrameBin,
wrap(Header, #mqtt_packet_puback{ packet_id = PacketId }, Rest);
{?PUBCOMP, <<FrameBin:Length/binary, Rest/binary>>} ->

View File

@ -229,10 +229,15 @@ handle_packet(?DISCONNECT, #mqtt_packet{}, State=#proto_state{peer_name = PeerNa
make_packet(Type) when Type >= ?CONNECT andalso Type =< ?DISCONNECT ->
#mqtt_packet{ header = #mqtt_packet_header { type = Type } }.
make_packet(PubAck, PacketId) when PubAck >= ?PUBACK andalso PubAck =< ?PUBREC ->
#mqtt_packet { header = #mqtt_packet_header { type = PubAck},
make_packet(PubAck, PacketId) when PubAck >= ?PUBACK andalso PubAck =< ?PUBCOMP ->
#mqtt_packet { header = #mqtt_packet_header { type = PubAck, qos = puback_qos(PubAck) },
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
Message :: mqtt_message(),
State :: proto_state(),

View File

@ -0,0 +1 @@
Subproject commit 17afdf7fb8e148f376d63592bbf3dd4ccdf19e84