Review code
This commit is contained in:
parent
7054d2c575
commit
87d2a7ca85
|
@ -477,32 +477,32 @@ listeners([]) ->
|
|||
end, Info)
|
||||
end, esockd:listeners());
|
||||
|
||||
listeners(["restart", Proto, ListenOn1]) ->
|
||||
ListenOn = case string:tokens(ListenOn1, ":") of
|
||||
listeners(["restart", Proto, ListenOn]) ->
|
||||
ListenOn1 = case string:tokens(ListenOn, ":") of
|
||||
[Port] -> list_to_integer(Port);
|
||||
[IP, Port] -> {IP, list_to_integer(Port)}
|
||||
end,
|
||||
case emqttd_app:restart_listener({list_to_atom(Proto), ListenOn, []}) of
|
||||
case emqttd_app:restart_listener({list_to_atom(Proto), ListenOn1, []}) of
|
||||
{ok, _Pid} ->
|
||||
io:format("Restart ~p listen on ~p successfully.~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn1)]);
|
||||
io:format("Restart ~s listen on ~s successfully.~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn)]);
|
||||
{error, Error} ->
|
||||
io:format("Failed to restart ~p listen on ~p, error:~p~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn1) ,Error])
|
||||
io:format("Failed to restart ~s listen on ~s, error:~p~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn) ,Error])
|
||||
end;
|
||||
|
||||
listeners(["stop", Proto, ListenOn1]) ->
|
||||
ListenOn = case string:tokens(ListenOn1, ":") of
|
||||
listeners(["stop", Proto, ListenOn]) ->
|
||||
ListenOn1 = case string:tokens(ListenOn, ":") of
|
||||
[Port] -> list_to_integer(Port);
|
||||
[IP, Port] -> {IP, list_to_integer(Port)}
|
||||
end,
|
||||
case emqttd_app:stop_listener({list_to_atom(Proto), ListenOn, []}) of
|
||||
case emqttd_app:stop_listener({list_to_atom(Proto), ListenOn1, []}) of
|
||||
ok ->
|
||||
io:format("Stop ~p on ~p successfully.~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn1)]);
|
||||
io:format("Stop ~s on ~s successfully.~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn)]);
|
||||
{error, Error} ->
|
||||
io:format("Failed to stop ~p on ~p, error:~p~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn1) ,Error])
|
||||
io:format("Failed to stop ~s on ~s, error:~p~n",
|
||||
[list_to_atom(Proto), list_to_atom(ListenOn) ,Error])
|
||||
end;
|
||||
|
||||
listeners(_) ->
|
||||
|
|
Loading…
Reference in New Issue