fix emqtt_messsage
This commit is contained in:
parent
69568cfb61
commit
46d1749120
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
-module(emqtt_message).
|
-module(emqtt_message).
|
||||||
|
|
||||||
|
-author('feng@emqtt.io').
|
||||||
|
|
||||||
-include("emqtt.hrl").
|
-include("emqtt.hrl").
|
||||||
|
|
||||||
-include("emqtt_packet.hrl").
|
-include("emqtt_packet.hrl").
|
||||||
|
@ -44,8 +46,8 @@
|
||||||
%% @doc message from packet
|
%% @doc message from packet
|
||||||
%%
|
%%
|
||||||
from_packet(#mqtt_packet{ header = #mqtt_packet_header{ type = ?PUBLISH,
|
from_packet(#mqtt_packet{ header = #mqtt_packet_header{ type = ?PUBLISH,
|
||||||
qos = Qos,
|
|
||||||
retain = Retain,
|
retain = Retain,
|
||||||
|
qos = Qos,
|
||||||
dup = Dup },
|
dup = Dup },
|
||||||
variable = #mqtt_packet_publish{ topic_name = Topic,
|
variable = #mqtt_packet_publish{ topic_name = Topic,
|
||||||
packet_id = PacketId },
|
packet_id = PacketId },
|
||||||
|
|
|
@ -153,14 +153,14 @@ handle_packet(?CONNECT, Packet = #mqtt_packet {
|
||||||
handle_packet(?PUBLISH, Packet = #mqtt_packet {
|
handle_packet(?PUBLISH, Packet = #mqtt_packet {
|
||||||
header = #mqtt_packet_header {qos = ?QOS_0}},
|
header = #mqtt_packet_header {qos = ?QOS_0}},
|
||||||
State = #proto_state{session = Session}) ->
|
State = #proto_state{session = Session}) ->
|
||||||
emqtt_session:publish(Session, {?QOS_0, emqtt_messsage:from_packet(Packet)}),
|
emqtt_session:publish(Session, {?QOS_0, emqtt_message:from_packet(Packet)}),
|
||||||
{ok, State};
|
{ok, State};
|
||||||
|
|
||||||
handle_packet(?PUBLISH, Packet = #mqtt_packet {
|
handle_packet(?PUBLISH, Packet = #mqtt_packet {
|
||||||
header = #mqtt_packet_header { qos = ?QOS_1 },
|
header = #mqtt_packet_header { qos = ?QOS_1 },
|
||||||
variable = #mqtt_packet_publish{packet_id = PacketId }},
|
variable = #mqtt_packet_publish{packet_id = PacketId }},
|
||||||
State = #proto_state { session = Session }) ->
|
State = #proto_state { session = Session }) ->
|
||||||
emqtt_session:publish(Session, {?QOS_1, emqtt_messsage:from_packet(Packet)}),
|
emqtt_session:publish(Session, {?QOS_1, emqtt_message:from_packet(Packet)}),
|
||||||
send_packet( make_packet(?PUBACK, PacketId), State);
|
send_packet( make_packet(?PUBACK, PacketId), State);
|
||||||
|
|
||||||
handle_packet(?PUBLISH, Packet = #mqtt_packet {
|
handle_packet(?PUBLISH, Packet = #mqtt_packet {
|
||||||
|
|
Loading…
Reference in New Issue