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, [ {application, emqx_gateway_stomp, [
{description, "Stomp Gateway"}, {description, "Stomp Gateway"},
{vsn, "0.1.1"}, {vsn, "0.1.2"},
{registered, []}, {registered, []},
{applications, [kernel, stdlib, emqx, emqx_gateway]}, {applications, [kernel, stdlib, emqx, emqx_gateway]},
{env, []}, {env, []},

View File

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