From 7968b44240626bd4a76a9b4f36cad849c4c26431 Mon Sep 17 00:00:00 2001 From: Luca Favatella Date: Tue, 24 Jun 2014 01:46:32 +0100 Subject: Accept inet:ip_address() in net_adm:names/1 This change also simplifies the code avoiding a double (conditional) call to inet:gethostbyname/1 (in net_adm:names/1 and then erl_epmd:names/1). --- lib/kernel/src/net_adm.erl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/kernel/src/net_adm.erl') diff --git a/lib/kernel/src/net_adm.erl b/lib/kernel/src/net_adm.erl index 3f5eac7822..2cdfb76417 100644 --- a/lib/kernel/src/net_adm.erl +++ b/lib/kernel/src/net_adm.erl @@ -89,18 +89,13 @@ names() -> -spec names(Host) -> {ok, [{Name, Port}]} | {error, Reason} when - Host :: atom() | string(), + Host :: atom() | string() | inet:ip_address(), Name :: string(), Port :: non_neg_integer(), Reason :: address | file:posix(). names(Hostname) -> - case inet:gethostbyname(Hostname) of - {ok, {hostent, _Name, _ , _Af, _Size, [Addr | _]}} -> - erl_epmd:names(Addr); - Else -> - Else - end. + erl_epmd:names(Hostname). -spec dns_hostname(Host) -> {ok, Name} | {error, Host} when Host :: atom() | string(), -- cgit v1.2.3