diff --git a/src/emqx_mqtt_types.erl b/src/emqx_mqtt_types.erl index 0b231fc88..6beb17780 100644 --- a/src/emqx_mqtt_types.erl +++ b/src/emqx_mqtt_types.erl @@ -32,8 +32,8 @@ -type(reason_code() :: 0..16#FF). -type(packet_id() :: 1..16#FFFF). -type(properties() :: #{atom() => term()}). --type(subopts() :: #{rh := 0 | 1, - rap := 0 | 1 | 2, +-type(subopts() :: #{rh := 0 | 1 | 2, + rap := 0 | 1, nl := 0 | 1, qos := qos(), rc => reason_code() diff --git a/src/emqx_session.erl b/src/emqx_session.erl index e7e63763c..e8f8ed249 100644 --- a/src/emqx_session.erl +++ b/src/emqx_session.erl @@ -726,7 +726,7 @@ run_dispatch_steps([{qos, SubQoS}|Steps], Msg = #message{qos = PubQoS}, State = run_dispatch_steps(Steps, Msg#message{qos = min(SubQoS, PubQoS)}, State); run_dispatch_steps([{qos, SubQoS}|Steps], Msg = #message{qos = PubQoS}, State = #state{upgrade_qos = true}) -> run_dispatch_steps(Steps, Msg#message{qos = max(SubQoS, PubQoS)}, State); -run_dispatch_steps([{rap, false}|Steps], Msg = #message{flags = Flags}, State = #state{}) -> +run_dispatch_steps([{rap, 0}|Steps], Msg = #message{flags = Flags}, State = #state{}) -> Flags1 = maps:put(retain, false, Flags), run_dispatch_steps(Steps, Msg#message{flags = Flags1}, State); run_dispatch_steps([{rap, _}|Steps], Msg, State) ->