Fix some dialyzer warnings (#3988)
This commit is contained in:
parent
ca1e78677e
commit
2b481dabe7
|
@ -59,7 +59,7 @@ create(_Bindings, Params) ->
|
||||||
{ok, Banned} = pack_banned(NParams),
|
{ok, Banned} = pack_banned(NParams),
|
||||||
ok = emqx_mgmt:create_banned(Banned),
|
ok = emqx_mgmt:create_banned(Banned),
|
||||||
return({ok, maps:from_list(Params)});
|
return({ok, maps:from_list(Params)});
|
||||||
{error, Code, Message} ->
|
{error, Code, Message} ->
|
||||||
return({error, Code, Message})
|
return({error, Code, Message})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ delete(#{as := As, who := Who}, _) ->
|
||||||
{ok, NParams} ->
|
{ok, NParams} ->
|
||||||
do_delete(get_value(<<"as">>, NParams), get_value(<<"who">>, NParams)),
|
do_delete(get_value(<<"as">>, NParams), get_value(<<"who">>, NParams)),
|
||||||
return();
|
return();
|
||||||
{error, Code, Message} ->
|
{error, Code, Message} ->
|
||||||
return({error, Code, Message})
|
return({error, Code, Message})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -105,6 +105,8 @@ validate_params(Params) ->
|
||||||
{error, ?ERROR8, Msg}
|
{error, ?ERROR8, Msg}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
%% TODO who and reason is undefined - causing dialyzer errors. fix later
|
||||||
|
-dialyzer({nowarn_function,pack_banned/1}).
|
||||||
pack_banned(Params) ->
|
pack_banned(Params) ->
|
||||||
Now = erlang:system_time(second),
|
Now = erlang:system_time(second),
|
||||||
do_pack_banned(Params, #banned{by = <<"user">>,
|
do_pack_banned(Params, #banned{by = <<"user">>,
|
||||||
|
|
|
@ -145,6 +145,7 @@
|
||||||
|
|
||||||
-record(banned, {
|
-record(banned, {
|
||||||
who :: {clientid, binary()}
|
who :: {clientid, binary()}
|
||||||
|
| {peerhost, inet:ip_address()}
|
||||||
| {username, binary()}
|
| {username, binary()}
|
||||||
| {ip_address, inet:ip_address()},
|
| {ip_address, inet:ip_address()},
|
||||||
by :: binary(),
|
by :: binary(),
|
||||||
|
|
|
@ -184,7 +184,7 @@ hook(HookPoint, Action, InitArgs) when is_list(InitArgs) ->
|
||||||
hook(HookPoint, Action, Filter, Priority) ->
|
hook(HookPoint, Action, Filter, Priority) ->
|
||||||
emqx_hooks:add(HookPoint, Action, Filter, Priority).
|
emqx_hooks:add(HookPoint, Action, Filter, Priority).
|
||||||
|
|
||||||
-spec(unhook(emqx_hooks:hookpoint(), fun() | {atom(), atom()} | {atom(), atom(), [any()]}) -> ok).
|
-spec(unhook(emqx_hooks:hookpoint(), emqx_hooks:action() | {module(), atom()}) -> ok).
|
||||||
unhook(HookPoint, Action) ->
|
unhook(HookPoint, Action) ->
|
||||||
emqx_hooks:del(HookPoint, Action).
|
emqx_hooks:del(HookPoint, Action).
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ put(HookPoint, Callback) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Unregister a callback.
|
%% @doc Unregister a callback.
|
||||||
-spec(del(hookpoint(), function() | {module(), atom()}) -> ok).
|
-spec(del(hookpoint(), action() | {module(), atom()}) -> ok).
|
||||||
del(HookPoint, Action) ->
|
del(HookPoint, Action) ->
|
||||||
gen_server:cast(?SERVER, {del, HookPoint, Action}).
|
gen_server:cast(?SERVER, {del, HookPoint, Action}).
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
expiry_interval => non_neg_integer(),
|
expiry_interval => non_neg_integer(),
|
||||||
atom() => term()
|
atom() => term()
|
||||||
}).
|
}).
|
||||||
-type(clientinfo() :: #{zone := zone(),
|
-type(clientinfo() :: #{zone := maybe(zone()),
|
||||||
protocol := protocol(),
|
protocol := protocol(),
|
||||||
peerhost := peerhost(),
|
peerhost := peerhost(),
|
||||||
sockport := non_neg_integer(),
|
sockport := non_neg_integer(),
|
||||||
|
|
Loading…
Reference in New Issue