Fixed issue #1314. re-sent retained messages when create/replace Subscription
- re-sent message when create a new Subscription relationship - re-sent message when replace an existed Subscription with different Qos
This commit is contained in:
parent
586c3a243a
commit
84d8eae37e
|
@ -389,14 +389,15 @@ handle_cast({subscribe, _From, TopicTable, AckFun},
|
||||||
SubMap;
|
SubMap;
|
||||||
{ok, OldQos} ->
|
{ok, OldQos} ->
|
||||||
emqttd:setqos(Topic, ClientId, NewQos),
|
emqttd:setqos(Topic, ClientId, NewQos),
|
||||||
|
emqttd_hooks:run('session.subscribed', [ClientId, Username], {Topic, Opts}),
|
||||||
?LOG(warning, "Duplicated subscribe ~s, old_qos=~w, new_qos=~w",
|
?LOG(warning, "Duplicated subscribe ~s, old_qos=~w, new_qos=~w",
|
||||||
[Topic, OldQos, NewQos], State),
|
[Topic, OldQos, NewQos], State),
|
||||||
maps:put(Topic, NewQos, SubMap);
|
maps:put(Topic, NewQos, SubMap);
|
||||||
error ->
|
error ->
|
||||||
emqttd:subscribe(Topic, ClientId, Opts),
|
emqttd:subscribe(Topic, ClientId, Opts),
|
||||||
|
emqttd_hooks:run('session.subscribed', [ClientId, Username], {Topic, Opts}),
|
||||||
maps:put(Topic, NewQos, SubMap)
|
maps:put(Topic, NewQos, SubMap)
|
||||||
end,
|
end,
|
||||||
emqttd_hooks:run('session.subscribed', [ClientId, Username], {Topic, Opts}),
|
|
||||||
{[NewQos|QosAcc], SubMap1}
|
{[NewQos|QosAcc], SubMap1}
|
||||||
end, {[], Subscriptions}, TopicTable),
|
end, {[], Subscriptions}, TopicTable),
|
||||||
AckFun(lists:reverse(GrantedQos)),
|
AckFun(lists:reverse(GrantedQos)),
|
||||||
|
|
Loading…
Reference in New Issue