ejabberd_app: Print address and port where listens for erlang node connections
This commit is contained in:
@@ -68,6 +68,7 @@ start(normal, _Args) ->
|
||||
maybe_print_elixir_version(),
|
||||
?INFO_MSG("~ts",
|
||||
[erlang:system_info(system_version)]),
|
||||
print_distribution_listening(),
|
||||
{ok, SupPid};
|
||||
Err ->
|
||||
?CRITICAL_MSG("Failed to start ejabberd application: ~p", [Err]),
|
||||
@@ -224,3 +225,14 @@ start_elixir_application() -> ok.
|
||||
maybe_start_exsync() -> ok.
|
||||
maybe_print_elixir_version() -> ok.
|
||||
-endif.
|
||||
|
||||
print_distribution_listening() ->
|
||||
{links, Links} = erlang:process_info(erlang:whereis(net_kernel), links),
|
||||
{Addr, Port} = lists:foldl(
|
||||
fun(Link, Acc) ->
|
||||
case catch inet:sockname(Link) of
|
||||
{ok, {A1, P1}} -> {misc:ip_to_list(A1), P1};
|
||||
_ -> Acc
|
||||
end
|
||||
end, "", Links),
|
||||
?INFO_MSG("Start accepting TCP connections at ~ts:~p for erlang node distribution", [Addr, Port]).
|
||||
|
||||
Reference in New Issue
Block a user