aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/erl_distribution.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-08 10:12:34 +0100
committerBjörn Gustavsson <[email protected]>2016-03-14 13:13:45 +0100
commitbb2f9e3ebecf5101c142887c41d3db4e3e88118f (patch)
treebef9770055e6ec84f29c75598c2b5a0d888206f5 /lib/kernel/src/erl_distribution.erl
parent51628bfae821e184878f97d1e81d8c0c7f8e433e (diff)
downloadotp-bb2f9e3ebecf5101c142887c41d3db4e3e88118f.tar.gz
otp-bb2f9e3ebecf5101c142887c41d3db4e3e88118f.tar.bz2
otp-bb2f9e3ebecf5101c142887c41d3db4e3e88118f.zip
Make distribution failures during start-up easier to read
When an attempt is made to start a distributed Erlang node with the same name as an existing node, the crash reports for several supervisors would be displayed. Only the first line contains useful information. The verbiage is annoying for old hands and could easily scare newcomers away for good. For all the common distribution failures during start-up, write a simple message and terminate the emulator using halt/1. Here is an example of what will be printed: Protocol 'inet_tcp': the name somename@somehost seems to be in use by another Erlang node
Diffstat (limited to 'lib/kernel/src/erl_distribution.erl')
-rw-r--r--lib/kernel/src/erl_distribution.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/kernel/src/erl_distribution.erl b/lib/kernel/src/erl_distribution.erl
index 142807d6a0..559e2a853b 100644
--- a/lib/kernel/src/erl_distribution.erl
+++ b/lib/kernel/src/erl_distribution.erl
@@ -21,7 +21,7 @@
-behaviour(supervisor).
--export([start_link/0,start_link/1,init/1,start/1,stop/0]).
+-export([start_link/0,start_link/2,init/1,start/1,stop/0]).
-define(DBG,erlang:display([?MODULE,?LINE])).
@@ -34,7 +34,7 @@ start_link() ->
%% system has already started.
start(Args) ->
- C = {net_sup_dynamic, {?MODULE,start_link,[Args]}, permanent,
+ C = {net_sup_dynamic, {?MODULE,start_link,[Args,false]}, permanent,
1000, supervisor, [erl_distribution]},
supervisor:start_child(kernel_sup, C).
@@ -60,8 +60,8 @@ stop() ->
%% Helper start function.
-start_link(Args) ->
- supervisor:start_link({local,net_sup}, ?MODULE, Args).
+start_link(Args, CleanHalt) ->
+ supervisor:start_link({local,net_sup}, ?MODULE, [Args,CleanHalt]).
init(NetArgs) ->
Epmd =
@@ -74,7 +74,7 @@ init(NetArgs) ->
permanent,2000,worker,[EpmdMod]}]
end,
Auth = {auth,{auth,start_link,[]},permanent,2000,worker,[auth]},
- Kernel = {net_kernel,{net_kernel,start_link,[NetArgs]},
+ Kernel = {net_kernel,{net_kernel,start_link,NetArgs},
permanent,2000,worker,[net_kernel]},
EarlySpecs = net_kernel:protocol_childspecs(),
{ok,{{one_for_all,0,1}, EarlySpecs ++ Epmd ++ [Auth,Kernel]}}.
@@ -82,7 +82,7 @@ init(NetArgs) ->
do_start_link([{Arg,Flag}|T]) ->
case init:get_argument(Arg) of
{ok,[[Name]]} ->
- start_link([list_to_atom(Name),Flag|ticktime()]);
+ start_link([list_to_atom(Name),Flag|ticktime()], true);
_ ->
do_start_link(T)
end;