fix(stomp): not allow to create same subscriptions

This commit is contained in:
JianBo He 2023-07-05 14:13:25 +08:00
parent 3c91a65804
commit 0483c6afef
2 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_gateway_stomp, [
{description, "Stomp Gateway"},
{vsn, "0.1.1"},
{vsn, "0.1.2"},
{registered, []},
{applications, [kernel, stdlib, emqx, emqx_gateway]},
{env, []},

View File

@ -695,12 +695,15 @@ check_subscribed_status(
) ->
MountedTopic = emqx_mountpoint:mount(Mountpoint, ParsedTopic),
case lists:keyfind(SubId, 1, Subs) of
{SubId, MountedTopic, _Ack, _} ->
ok;
{SubId, _OtherTopic, _Ack, _} ->
{SubId, _MountedTopic, _Ack, _} ->
{error, subscription_id_inused};
false ->
ok
case lists:keyfind(MountedTopic, 2, Subs) of
{_OtherSubId, MountedTopic, _Ack, _} ->
{error, subscription_inused};
false ->
ok
end
end.
check_sub_acl(