diff options
author | Luca Favatella <[email protected]> | 2014-06-24 01:46:32 +0100 |
---|---|---|
committer | Marcus Arendt <[email protected]> | 2014-08-14 16:49:08 +0200 |
commit | 7968b44240626bd4a76a9b4f36cad849c4c26431 (patch) | |
tree | e38b1bff7ce9bc70b152c150f5fc2c5065e5145e | |
parent | 40020d973f3096f56ecb9524ff2712f064487ef4 (diff) | |
download | otp-7968b44240626bd4a76a9b4f36cad849c4c26431.tar.gz otp-7968b44240626bd4a76a9b4f36cad849c4c26431.tar.bz2 otp-7968b44240626bd4a76a9b4f36cad849c4c26431.zip |
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).
-rw-r--r-- | lib/kernel/src/net_adm.erl | 9 |
1 files changed, 2 insertions, 7 deletions
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(), |