Merge pull request #539 from emqtt/emq10

1.0.2 - bugfix
This commit is contained in:
Feng Lee 2016-05-04 01:36:07 +08:00
commit a255d38fa8
15 changed files with 56 additions and 17 deletions

3
.gitmodules vendored
View File

@ -22,3 +22,6 @@
[submodule "plugins/emqttd_plugin_redis"] [submodule "plugins/emqttd_plugin_redis"]
path = plugins/emqttd_plugin_redis path = plugins/emqttd_plugin_redis
url = https://github.com/emqtt/emqttd_plugin_redis.git url = https://github.com/emqtt/emqttd_plugin_redis.git
[submodule "plugins/emqttd_reloader"]
path = plugins/emqttd_reloader
url = https://github.com/emqtt/emqttd_reloader.git

View File

@ -5,7 +5,23 @@
Changes Changes
======= =======
.. _release_1.0.1: .. _release_1.0.2:
-------------
Version 1.0.2
-------------
*Release Date: 2016-05-04*
Issue#534 - './bin/emqttd_ctl vm' - add 'port/count', 'port/limit' statistics
Issue#535 - emqttd_client should be terminated properly even if exception happened when sending data
PR#519 - The erlang '-name' requires the fully qualified host name
emqttd_reloader plugin - help reload modified modules during development.
.. _release_l.0.1:
------------- -------------
Version 1.0.1 Version 1.0.1

@ -1 +1 @@
Subproject commit 0a59835106c7672699da7c2f9deb576678fdb37e Subproject commit db9ed84da2c5f578f5762a6a69f715b7edafa02f

@ -1 +1 @@
Subproject commit d714c759804f9528f187fadd544912e37fd664b0 Subproject commit dfc35e6960a5ddbba8619cf92e72bf14dda4a54c

@ -1 +1 @@
Subproject commit 81f0164a339044d329c3179f922df332ae102696 Subproject commit c81f663312ae371808fe10a5997ea78c3033eae7

@ -1 +1 @@
Subproject commit 9fef7a1b762dfd8ad27190ebe31dd3afc784c6fa Subproject commit fa2b98ffa808242850fe118660ab77be3b6ea3ba

@ -1 +1 @@
Subproject commit 6e1382b63096cc3259f7edc6c26adc571ee53d74 Subproject commit 653e37d8e472b121c454fa2acd51f696ff144bd5

@ -0,0 +1 @@
Subproject commit aaaa7c5d11ffb681a79a264200602c5b7dc2dc1a

@ -1 +1 @@
Subproject commit b8b5393ecda9617a2b724dae0ab431d368963ca4 Subproject commit 39650c4685a38cecbdac785c3aafcd4c669aa301

View File

@ -46,7 +46,7 @@
%% Authetication. Anonymous Default %% Authetication. Anonymous Default
{auth, [ {auth, [
%% Authentication with username, password %% Authentication with username, password
%{username, []}, {username, [{test, "password"}, {"test1", "password1"}]},
%% Authentication with clientid %% Authentication with clientid
%{clientid, [{password, no}, {file, "etc/clients.config"}]}, %{clientid, [{password, no}, {file, "etc/clients.config"}]},

View File

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

View File

@ -77,6 +77,9 @@ add_user(Username, Password) ->
User = #?AUTH_USERNAME_TAB{username = Username, password = hash(Password)}, User = #?AUTH_USERNAME_TAB{username = Username, password = hash(Password)},
ret(mnesia:transaction(fun mnesia:write/1, [User])). ret(mnesia:transaction(fun mnesia:write/1, [User])).
add_default_user(Username, Password) when is_atom(Username) ->
add_default_user(atom_to_list(Username), Password);
add_default_user(Username, Password) -> add_default_user(Username, Password) ->
add_user(iolist_to_binary(Username), iolist_to_binary(Password)). add_user(iolist_to_binary(Username), iolist_to_binary(Password)).

View File

@ -368,7 +368,7 @@ vm([]) ->
vm(["all"]); vm(["all"]);
vm(["all"]) -> vm(["all"]) ->
[vm([Name]) || Name <- ["load", "memory", "process", "io"]]; [vm([Name]) || Name <- ["load", "memory", "process", "io", "ports"]];
vm(["load"]) -> vm(["load"]) ->
[?PRINT("cpu/~-20s: ~s~n", [L, V]) || {L, V} <- emqttd_vm:loads()]; [?PRINT("cpu/~-20s: ~s~n", [L, V]) || {L, V} <- emqttd_vm:loads()];
@ -387,12 +387,18 @@ vm(["io"]) ->
?PRINT("io/~-21s: ~w~n", [Key, get_value(Key, IoInfo)]) ?PRINT("io/~-21s: ~w~n", [Key, get_value(Key, IoInfo)])
end, [max_fds, active_fds]); end, [max_fds, active_fds]);
vm(["ports"]) ->
foreach(fun({Name, Key}) ->
?PRINT("ports/~-16s: ~w~n", [Name, erlang:system_info(Key)])
end, [{count, port_count}, {limit, port_limit}]);
vm(_) -> vm(_) ->
?USAGE([{"vm all", "Show info of erlang vm"}, ?USAGE([{"vm all", "Show info of Erlang VM"},
{"vm load", "Show load of erlang vm"}, {"vm load", "Show load of Erlang VM"},
{"vm memory", "Show memory of erlang vm"}, {"vm memory", "Show memory of Erlang VM"},
{"vm process", "Show process of erlang vm"}, {"vm process", "Show process of Erlang VM"},
{"vm io", "Show IO of erlang vm"}]). {"vm io", "Show IO of Erlang VM"},
{"vm ports", "Show Ports of Erlang VM"}]).
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% @doc mnesia Command %% @doc mnesia Command

View File

@ -79,11 +79,12 @@ init([OriginConn, MqttEnv]) ->
exit({shutdown, Reason}) exit({shutdown, Reason})
end, end,
ConnName = esockd_net:format(PeerName), ConnName = esockd_net:format(PeerName),
Self = self(),
SendFun = fun(Data) -> SendFun = fun(Data) ->
try Connection:async_send(Data) of try Connection:async_send(Data) of
true -> ok true -> ok
catch catch
error:Error -> exit({shutdown, Error}) error:Error -> Self ! {shutdown, Error}
end end
end, end,
PktOpts = proplists:get_value(packet, MqttEnv), PktOpts = proplists:get_value(packet, MqttEnv),
@ -138,6 +139,10 @@ handle_cast(Msg, State) ->
handle_info(timeout, State) -> handle_info(timeout, State) ->
shutdown(idle_timeout, State); shutdown(idle_timeout, State);
%% fix issue #535
handle_info({shutdown, Error}, State) ->
shutdown(Error, State);
%% Asynchronous SUBACK %% Asynchronous SUBACK
handle_info({suback, PacketId, GrantedQos}, State) -> handle_info({suback, PacketId, GrantedQos}, State) ->
with_proto_state(fun(ProtoState) -> with_proto_state(fun(ProtoState) ->

View File

@ -74,7 +74,8 @@ groups() ->
cli_subscriptions, cli_subscriptions,
cli_bridges, cli_bridges,
cli_plugins, cli_plugins,
cli_listeners]}]. cli_listeners,
cli_vm]}].
init_per_suite(Config) -> init_per_suite(Config) ->
application:start(lager), application:start(lager),
@ -419,3 +420,7 @@ cli_bridges(_) ->
cli_listeners(_) -> cli_listeners(_) ->
emqttd_cli:listeners([]). emqttd_cli:listeners([]).
cli_vm(_) ->
emqttd_cli:vm([]),
emqttd_cli:vm(["ports"]).