diff options
author | Magnus Henoch <[email protected]> | 2013-01-25 16:54:12 +0000 |
---|---|---|
committer | Magnus Henoch <[email protected]> | 2013-01-25 16:54:12 +0000 |
commit | 0e328bd14f2bc0e05cfc1ce6c44f3692af58ea03 (patch) | |
tree | 582701e2776f1c05245aae7951331ab139b84720 /lib | |
parent | 907d498ff798345fc8e8b71fc08a1c5b40112037 (diff) | |
download | otp-0e328bd14f2bc0e05cfc1ce6c44f3692af58ea03.tar.gz otp-0e328bd14f2bc0e05cfc1ce6c44f3692af58ea03.tar.bz2 otp-0e328bd14f2bc0e05cfc1ce6c44f3692af58ea03.zip |
Slightly nicer error message when node start fails due to duplicate name
When starting up an Erlang node using a node name that is already in
use, the new node used to crash with output starting with this message:
{error_logger,{{2013,1,25},{16,0,42}},"Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1,[.....
With this change, the first line in the output changes to:
{error_logger,{{2013,1,25},{16,40,41}},"Protocol: ~tp: the name foo@localhost seems to be in use by another Erlang node",["inet_tcp"]}
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/src/inet6_tcp_dist.erl | 8 | ||||
-rw-r--r-- | lib/kernel/src/inet_tcp_dist.erl | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl index b9c4fa607c..2315a56582 100644 --- a/lib/kernel/src/inet6_tcp_dist.erl +++ b/lib/kernel/src/inet6_tcp_dist.erl @@ -71,8 +71,12 @@ listen(Name) -> {ok, Socket} -> TcpAddress = get_tcp_address(Socket), {_,Port} = TcpAddress#net_address.address, - {ok, Creation} = erl_epmd:register_node(Name, Port), - {ok, {Socket, TcpAddress, Creation}}; + case erl_epmd:register_node(Name, Port) of + {ok, Creation} -> + {ok, {Socket, TcpAddress, Creation}}; + Error -> + Error + end; Error -> Error end. diff --git a/lib/kernel/src/inet_tcp_dist.erl b/lib/kernel/src/inet_tcp_dist.erl index 7f935c2b36..70f3c87723 100644 --- a/lib/kernel/src/inet_tcp_dist.erl +++ b/lib/kernel/src/inet_tcp_dist.erl @@ -67,8 +67,12 @@ listen(Name) -> {ok, Socket} -> TcpAddress = get_tcp_address(Socket), {_,Port} = TcpAddress#net_address.address, - {ok, Creation} = erl_epmd:register_node(Name, Port), - {ok, {Socket, TcpAddress, Creation}}; + case erl_epmd:register_node(Name, Port) of + {ok, Creation} -> + {ok, {Socket, TcpAddress, Creation}}; + Error -> + Error + end; Error -> Error end. |