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