Skip to content

Commit

Permalink
Merge pull request #1800 from terry-xiaoyu/ignor_zero_will_delay
Browse files Browse the repository at this point in the history
Ignore Will-Delay-Interval = 0
  • Loading branch information
turtleDeng committed Sep 8, 2018
2 parents c0ddbba + 2121da3 commit c8341c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/emqx_protocol.erl
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ process_packet(?SUBSCRIBE_PACKET(PacketId, Properties, RawTopicFilters),
end;
true ->
RawTopicFilters
end,
end,
case check_subscribe(
parse_topic_filters(?SUBSCRIBE, RawTopicFilters1), PState) of
{ok, TopicFilters} ->
Expand Down Expand Up @@ -732,7 +732,8 @@ shutdown(Reason, PState = #pstate{connected = true,
send_willmsg(undefined) ->
ignore;
send_willmsg(WillMsg = #message{topic = Topic,
headers = #{'Will-Delay-Interval' := Interval}}) when is_integer(Interval) ->
headers = #{'Will-Delay-Interval' := Interval}})
when is_integer(Interval), Interval > 0 ->
SendAfter = integer_to_binary(Interval),
emqx_broker:publish(WillMsg#message{topic = <<"$delayed/", SendAfter/binary, "/", Topic/binary>>});
send_willmsg(WillMsg) ->
Expand Down

0 comments on commit c8341c8

Please sign in to comment.