From 3e203710374544fb547a72cf4fde3e2c3b98e199 Mon Sep 17 00:00:00 2001 From: Andreas Schultz Date: Thu, 1 Jun 2023 10:02:34 +0200 Subject: [PATCH] catch nxdomain in epmdless_static --- src/epmdless_static.erl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/epmdless_static.erl b/src/epmdless_static.erl index 4ce2084..f66a805 100644 --- a/src/epmdless_static.erl +++ b/src/epmdless_static.erl @@ -61,13 +61,18 @@ port_please(_Name, _Host) -> {error, noport} end. +%% @doc Resolves the Host to an IP address of a remote node. address_please(Name, Host, AddressFamily) -> - {ok, Address} = inet:getaddr(Host, AddressFamily), - case port_please(Name, Address) of - {port, Port, Version} -> - {ok, Address, Port, Version}; - {error, noport} -> - {error, noport} + case inet:getaddr(Host, AddressFamily) of + {ok, Address} -> + case port_please(Name, Address) of + {port, Port, Version} -> + {ok, Address, Port, Version}; + noport -> + {error, noport} + end; + {error, Reason} -> + {error, Reason} end. %% @doc Returns the port the local node should listen to when accepting new distribution requests.