fix issue#542

This commit is contained in:
Feng Lee 2016-05-05 15:36:44 +08:00
parent f6f6dfdb8d
commit f50efa5813
2 changed files with 3 additions and 2 deletions

View File

@ -89,7 +89,7 @@ check_acl(Client, PubSub, Topic, [{Mod, State, _Seq}|AclMods]) ->
end.
%% @doc Reload ACL Rules.
-spec(reload_acl() -> list(ok | {error, any()})).
-spec(reload_acl() -> list(ok | {error, alread_existed})).
reload_acl() ->
[Mod:reload_acl(State) || {Mod, State, _Seq} <- lookup_mods(acl)].
@ -201,5 +201,5 @@ mod(Prefix, Name) ->
list_to_atom(lists:concat([Prefix, Name])).
if_existed(false, Fun) -> Fun();
if_existed(true, _Fun) -> {error, existed}.
if_existed(_Mod, _Fun) -> {error, alread_existed}.

View File

@ -78,6 +78,7 @@ reload_acl(_) ->
register_mod(_) ->
ok = ?AC:register_mod(acl, emqttd_acl_test_mod, []),
{error, alread_existed} = ?AC:register_mod(acl, emqttd_acl_test_mod, []),
[{emqttd_acl_test_mod, _, 0},
{emqttd_acl_internal, _, 0}] = ?AC:lookup_mods(acl),
ok = ?AC:register_mod(auth, emqttd_auth_anonymous_test_mod,[]),