diff options
author | Marcus Arendt <[email protected]> | 2014-08-21 10:40:16 +0200 |
---|---|---|
committer | Marcus Arendt <[email protected]> | 2014-08-21 10:40:16 +0200 |
commit | 4e688cf875e993ca27d29771ad31558934af99c7 (patch) | |
tree | b88effd48a556a70e468a1b07eccb89d67d80b64 /lib/kernel/src | |
parent | 305bfc3360acfae8af75b36e00c61298b6ea582e (diff) | |
parent | fcef4dd4614211ca5cc592c428655cbad0342fa2 (diff) | |
download | otp-4e688cf875e993ca27d29771ad31558934af99c7.tar.gz otp-4e688cf875e993ca27d29771ad31558934af99c7.tar.bz2 otp-4e688cf875e993ca27d29771ad31558934af99c7.zip |
Merge branch 'lucafavatella/accept-ip-in-net_adm-names' into maint
* lucafavatella/accept-ip-in-net_adm-names:
Refactor erl_epmd:names/1
Accept inet:ip_address() in net_adm:names/1
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/erl_epmd.erl | 15 | ||||
-rw-r--r-- | lib/kernel/src/net_adm.erl | 9 |
2 files changed, 7 insertions, 17 deletions
diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl index b4fae24ef3..f6e2ca0954 100644 --- a/lib/kernel/src/erl_epmd.erl +++ b/lib/kernel/src/erl_epmd.erl @@ -85,24 +85,19 @@ port_please1(Node,HostName, Timeout) -> Else end. -names() -> +names() -> {ok, H} = inet:gethostname(), names(H). -names(HostName) when is_atom(HostName) -> - names1(atom_to_list(HostName)); -names(HostName) when is_list(HostName) -> - names1(HostName); -names(EpmdAddr) -> - get_names(EpmdAddr). - -names1(HostName) -> +names(HostName) when is_atom(HostName); is_list(HostName) -> case inet:gethostbyname(HostName) of {ok,{hostent, _Name, _ , _Af, _Size, [EpmdAddr | _]}} -> get_names(EpmdAddr); Else -> Else - end. + end; +names(EpmdAddr) -> + get_names(EpmdAddr). register_node(Name, PortNo) -> 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(), |