ejabberd_app: Print address and port where listens for erlang node connections

This commit is contained in:
Badlop
2025-12-03 22:29:13 +01:00
parent 6a598ee3cb
commit c35605ecce
+12
View File
@@ -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]).