aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-08 07:20:13 +0100
committerBjörn Gustavsson <[email protected]>2016-03-11 10:10:23 +0100
commit20e4f4fd8eefc85d8101d7b40a5c5e3cb90c8f8b (patch)
treec051db689cd6744ae71c591e98c1380adec1a190 /lib/kernel/src
parentb5e35d8da2c83f176071730b0e7ce7daa7866f56 (diff)
downloadotp-20e4f4fd8eefc85d8101d7b40a5c5e3cb90c8f8b.tar.gz
otp-20e4f4fd8eefc85d8101d7b40a5c5e3cb90c8f8b.tar.bz2
otp-20e4f4fd8eefc85d8101d7b40a5c5e3cb90c8f8b.zip
erl_distribution: Simplify start_link/0 and friends
start_link/0 and friends are too convoluted for me.
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/erl_distribution.erl32
1 files changed, 8 insertions, 24 deletions
diff --git a/lib/kernel/src/erl_distribution.erl b/lib/kernel/src/erl_distribution.erl
index e97c9db81f..142807d6a0 100644
--- a/lib/kernel/src/erl_distribution.erl
+++ b/lib/kernel/src/erl_distribution.erl
@@ -28,12 +28,7 @@
%% Called during system start-up.
start_link() ->
- case catch start_p() of
- {ok,Args} ->
- start_link(Args);
- _ ->
- ignore
- end.
+ do_start_link([{sname,shortnames},{name,longnames}]).
%% Called from net_kernel:start/1 to start distribution after the
%% system has already started.
@@ -84,26 +79,15 @@ init(NetArgs) ->
EarlySpecs = net_kernel:protocol_childspecs(),
{ok,{{one_for_all,0,1}, EarlySpecs ++ Epmd ++ [Auth,Kernel]}}.
-start_p() ->
- sname(),
- lname(),
- false.
-
-sname() ->
- case init:get_argument(sname) of
- {ok,[[Name]]} ->
- throw({ok,[list_to_atom(Name),shortnames|ticktime()]});
- _ ->
- false
- end.
-
-lname() ->
- case init:get_argument(name) of
+do_start_link([{Arg,Flag}|T]) ->
+ case init:get_argument(Arg) of
{ok,[[Name]]} ->
- throw({ok,[list_to_atom(Name),longnames|ticktime()]});
+ start_link([list_to_atom(Name),Flag|ticktime()]);
_ ->
- false
- end.
+ do_start_link(T)
+ end;
+do_start_link([]) ->
+ ignore.
ticktime() ->
%% catch, in case the system was started with boot file start_old,