Fix bug in issue#1848
This commit is contained in:
parent
5afaac4641
commit
4336b7c9a0
|
@ -489,22 +489,30 @@ deliver({connack, ?RC_SUCCESS, SP}, PState = #pstate{zone = Zone,
|
||||||
max_topic_alias := MaxAlias,
|
max_topic_alias := MaxAlias,
|
||||||
mqtt_shared_subscription := Shared,
|
mqtt_shared_subscription := Shared,
|
||||||
mqtt_wildcard_subscription := Wildcard} = caps(PState),
|
mqtt_wildcard_subscription := Wildcard} = caps(PState),
|
||||||
Props = #{'Maximum-QoS' => MaxQoS,
|
Props = #{'Retain-Available' => flag(Retain),
|
||||||
'Retain-Available' => flag(Retain),
|
|
||||||
'Maximum-Packet-Size' => MaxPktSize,
|
'Maximum-Packet-Size' => MaxPktSize,
|
||||||
'Topic-Alias-Maximum' => MaxAlias,
|
'Topic-Alias-Maximum' => MaxAlias,
|
||||||
'Wildcard-Subscription-Available' => flag(Wildcard),
|
'Wildcard-Subscription-Available' => flag(Wildcard),
|
||||||
'Subscription-Identifier-Available' => 1,
|
'Subscription-Identifier-Available' => 1,
|
||||||
'Shared-Subscription-Available' => flag(Shared)},
|
'Shared-Subscription-Available' => flag(Shared)},
|
||||||
Props1 = if IsAssigned ->
|
|
||||||
Props#{'Assigned-Client-Identifier' => ClientId};
|
Props1 = if
|
||||||
true -> Props
|
MaxQoS =:= ?QOS_2 ->
|
||||||
|
Props;
|
||||||
|
true ->
|
||||||
|
maps:put('Maximum-QoS', MaxQoS, Props)
|
||||||
end,
|
end,
|
||||||
Props2 = case emqx_zone:get_env(Zone, server_keepalive) of
|
|
||||||
undefined -> Props1;
|
Props2 = if IsAssigned ->
|
||||||
Keepalive -> Props1#{'Server-Keep-Alive' => Keepalive}
|
Props1#{'Assigned-Client-Identifier' => ClientId};
|
||||||
|
true -> Props1
|
||||||
end,
|
end,
|
||||||
send(?CONNACK_PACKET(?RC_SUCCESS, SP, Props2), PState);
|
|
||||||
|
Props3 = case emqx_zone:get_env(Zone, server_keepalive) of
|
||||||
|
undefined -> Props2;
|
||||||
|
Keepalive -> Props2#{'Server-Keep-Alive' => Keepalive}
|
||||||
|
end,
|
||||||
|
send(?CONNACK_PACKET(?RC_SUCCESS, SP, Props3), PState);
|
||||||
|
|
||||||
deliver({connack, ReasonCode, SP}, PState) ->
|
deliver({connack, ReasonCode, SP}, PState) ->
|
||||||
send(?CONNACK_PACKET(ReasonCode, SP), PState);
|
send(?CONNACK_PACKET(ReasonCode, SP), PState);
|
||||||
|
|
Loading…
Reference in New Issue