Merge pull request #419 from emqtt/0.15

0.14.1 - bugfix, spec fix
This commit is contained in:
Feng Lee 2015-12-28 20:25:42 +08:00
commit d9846eefd9
8 changed files with 27 additions and 16 deletions

View File

@ -2,6 +2,14 @@
emqttd ChangeLog emqttd ChangeLog
================== ==================
0.14.1-beta(2015-12-28)
-------------------------
Bugfix: emqttd_ws_client.erl: Unexpected Info: {'EXIT',<0.27792.18>,{shutdown,destroy}} (#413)
Improve: fix spec errors found by dialyzer
0.14.0-beta(2015-12-18) 0.14.0-beta(2015-12-18)
------------------------- -------------------------

View File

@ -130,8 +130,8 @@
-record(mqtt_alarm, { -record(mqtt_alarm, {
id :: binary(), id :: binary(),
severity :: warning | error | critical, severity :: warning | error | critical,
title :: binary(), title :: iolist() | binary(),
summary :: binary(), summary :: iolist() | binary(),
timestamp :: erlang:timestamp() %% Timestamp timestamp :: erlang:timestamp() %% Timestamp
}). }).

View File

@ -1,7 +1,7 @@
{application, emqttd, {application, emqttd,
[ [
{id, "emqttd"}, {id, "emqttd"},
{vsn, "0.14.0"}, {vsn, "0.14.1"},
{description, "Erlang MQTT Broker"}, {description, "Erlang MQTT Broker"},
{modules, []}, {modules, []},
{registered, []}, {registered, []},

View File

@ -119,7 +119,7 @@ reload_acl() ->
register_mod(Type, Mod, Opts) when Type =:= auth; Type =:= acl-> register_mod(Type, Mod, Opts) when Type =:= auth; Type =:= acl->
register_mod(Type, Mod, Opts, 0). register_mod(Type, Mod, Opts, 0).
-spec register_mod(auth | acl, atom(), list(), pos_integer()) -> ok | {error, any()}. -spec register_mod(auth | acl, atom(), list(), non_neg_integer()) -> ok | {error, any()}.
register_mod(Type, Mod, Opts, Seq) when Type =:= auth; Type =:= acl-> register_mod(Type, Mod, Opts, Seq) when Type =:= auth; Type =:= acl->
gen_server:call(?SERVER, {register_mod, Type, Mod, Opts, Seq}). gen_server:call(?SERVER, {register_mod, Type, Mod, Opts, Seq}).

View File

@ -58,17 +58,20 @@ start_link() ->
%% @doc Register a command %% @doc Register a command
%% @end %% @end
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-spec register_cmd(atom(), {module(), atom()}, list()) -> true. -spec register_cmd(atom(), {module(), atom()}, list()) -> ok.
register_cmd(Cmd, MF, Opts) -> register_cmd(Cmd, MF, Opts) ->
gen_server:cast(?SERVER, {register_cmd, Cmd, MF, Opts}). cast({register_cmd, Cmd, MF, Opts}).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% @doc Unregister a command %% @doc Unregister a command
%% @end %% @end
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-spec unregister_cmd(atom()) -> true. -spec unregister_cmd(atom()) -> ok.
unregister_cmd(Cmd) -> unregister_cmd(Cmd) ->
gen_server:cast(?SERVER, {unregister_cmd, Cmd}). cast({unregister_cmd, Cmd}).
cast(Msg) ->
gen_server:cast(?SERVER, Msg).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% @doc Run a command %% @doc Run a command

View File

@ -226,12 +226,12 @@ inc(Metric) ->
%% @doc Increase metric value %% @doc Increase metric value
%% @end %% @end
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-spec inc(counter | gauge, atom()) -> non_neg_integer(). -spec inc({counter | gauge, atom()} | atom(), pos_integer()) -> non_neg_integer().
inc(gauge, Metric) -> inc({gauge, Metric}, Val) ->
inc(gauge, Metric, 1); inc(gauge, Metric, Val);
inc(counter, Metric) -> inc({counter, Metric}, Val) ->
inc(counter, Metric, 1); inc(counter, Metric, Val);
inc(Metric, Val) when is_atom(Metric) and is_integer(Val) -> inc(Metric, Val) when is_atom(Metric) ->
inc(counter, Metric, Val). inc(counter, Metric, Val).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------

View File

@ -142,7 +142,7 @@ name(Id) ->
%% @doc Create Topic or Subscription. %% @doc Create Topic or Subscription.
%% @end %% @end
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-spec create(topic | subscription, binary()) -> ok | {error, any()}. -spec create(topic | subscription, binary() | {binary(), binary(), mqtt_qos()}) -> ok | {error, any()}.
create(topic, Topic) when is_binary(Topic) -> create(topic, Topic) when is_binary(Topic) ->
Record = #mqtt_topic{topic = Topic, node = node()}, Record = #mqtt_topic{topic = Topic, node = node()},
case mnesia:transaction(fun add_topic/1, [Record]) of case mnesia:transaction(fun add_topic/1, [Record]) of

View File

@ -191,7 +191,7 @@ subscribe(SessPid, PacketId, TopicTable) ->
%% @doc Publish message %% @doc Publish message
%% @end %% @end
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-spec publish(pid(), mqtt_message()) -> ok. -spec publish(pid(), mqtt_message()) -> ok | {error, any()}.
publish(_SessPid, Msg = #mqtt_message{qos = ?QOS_0}) -> publish(_SessPid, Msg = #mqtt_message{qos = ?QOS_0}) ->
%% publish qos0 directly %% publish qos0 directly
emqttd_pubsub:publish(Msg); emqttd_pubsub:publish(Msg);