Fix issue #1461 - keep the retain flag for new subscription

This commit is contained in:
Feng Lee 2018-01-23 11:09:42 +08:00
parent 43712ea803
commit 701c632e07
1 changed files with 5 additions and 2 deletions

View File

@ -563,8 +563,11 @@ sp(false) -> 0.
%% The retained flag should be propagated for bridge.
%%--------------------------------------------------------------------
clean_retain(false, Msg = #mqtt_message{retain = true}) ->
Msg#mqtt_message{retain = false};
clean_retain(false, Msg = #mqtt_message{retain = true, headers = Headers}) ->
case lists:member(retained, Headers) of
true -> Msg;
false -> Msg#mqtt_message{retain = false}
end;
clean_retain(_IsBridge, Msg) ->
Msg.