Fix received/1 and sent/1 function spec

This commit is contained in:
HuangDan 2017-07-06 17:28:49 +08:00
parent 53145bbbba
commit e675959d57
2 changed files with 3 additions and 5 deletions

View File

@ -249,8 +249,6 @@ subscriptions(["add", ClientId, Topic, QoS]) ->
case emqttd:subscribe(bin(Topic), bin(ClientId), [{qos, IntQos}]) of case emqttd:subscribe(bin(Topic), bin(ClientId), [{qos, IntQos}]) of
ok -> ok ->
?PRINT_MSG("ok~n"); ?PRINT_MSG("ok~n");
{error, already_existed} ->
?PRINT_MSG("Error: already existed~n");
{error, Reason} -> {error, Reason} ->
?PRINT("Error: ~p~n", [Reason]) ?PRINT("Error: ~p~n", [Reason])
end end

View File

@ -102,7 +102,7 @@ start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
%% @doc Count packets received. %% @doc Count packets received.
-spec(received(mqtt_packet()) -> ok). -spec(received(mqtt_packet()) -> ignore | non_neg_integer()).
received(Packet) -> received(Packet) ->
inc('packets/received'), inc('packets/received'),
received1(Packet). received1(Packet).
@ -140,7 +140,7 @@ qos_received(?QOS_2) ->
inc('messages/qos2/received'). inc('messages/qos2/received').
%% @doc Count packets received. Will not count $SYS PUBLISH. %% @doc Count packets received. Will not count $SYS PUBLISH.
-spec(sent(mqtt_packet()) -> ok). -spec(sent(mqtt_packet()) -> ignore | non_neg_integer()).
sent(?PUBLISH_PACKET(_Qos, <<"$SYS/", _/binary>>, _, _)) -> sent(?PUBLISH_PACKET(_Qos, <<"$SYS/", _/binary>>, _, _)) ->
ignore; ignore;
sent(Packet) -> sent(Packet) ->
@ -169,7 +169,7 @@ sent2(?UNSUBACK) ->
sent2(?PINGRESP) -> sent2(?PINGRESP) ->
inc('packets/pingresp'); inc('packets/pingresp');
sent2(_Type) -> sent2(_Type) ->
ingore. ignore.
qos_sent(?QOS_0) -> qos_sent(?QOS_0) ->
inc('messages/qos0/sent'); inc('messages/qos0/sent');
qos_sent(?QOS_1) -> qos_sent(?QOS_1) ->