aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_acceptor_sup.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-03-23 16:53:53 +0100
committerHans Nilsson <[email protected]>2017-04-07 10:23:35 +0200
commit8f4bb9b0bd3aed663521371726ea3ec460e231a0 (patch)
tree78957c1854efbe5c556a1f2ef99dcbc72a3ac81a /lib/ssh/src/ssh_acceptor_sup.erl
parent6158cb432092c47e178b4dc1177b46cb8c310ab4 (diff)
downloadotp-8f4bb9b0bd3aed663521371726ea3ec460e231a0.tar.gz
otp-8f4bb9b0bd3aed663521371726ea3ec460e231a0.tar.bz2
otp-8f4bb9b0bd3aed663521371726ea3ec460e231a0.zip
ssh: Mappify supervisors
Diffstat (limited to 'lib/ssh/src/ssh_acceptor_sup.erl')
-rw-r--r--lib/ssh/src/ssh_acceptor_sup.erl30
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/ssh/src/ssh_acceptor_sup.erl b/lib/ssh/src/ssh_acceptor_sup.erl
index 4606107f56..3ad842f98c 100644
--- a/lib/ssh/src/ssh_acceptor_sup.erl
+++ b/lib/ssh/src/ssh_acceptor_sup.erl
@@ -48,9 +48,12 @@ start_child(AccSup, Address, Port, Profile, Options) ->
Spec = child_spec(Address, Port, Profile, Options),
case supervisor:start_child(AccSup, Spec) of
{error, already_present} ->
+ %% Is this ever called?
stop_child(AccSup, Address, Port, Profile),
supervisor:start_child(AccSup, Spec);
Reply ->
+ %% Reply = {ok,SystemSupPid} when the user calls ssh:daemon
+ %% after having called ssh:stop_listening
Reply
end.
@@ -67,24 +70,27 @@ stop_child(AccSup, Address, Port, Profile) ->
%%% Supervisor callback
%%%=========================================================================
init([Address, Port, Profile, Options]) ->
- RestartStrategy = one_for_one,
- MaxR = 10,
- MaxT = 3600,
- Children = [child_spec(Address, Port, Profile, Options)],
- {ok, {{RestartStrategy, MaxR, MaxT}, Children}}.
+ %% Initial start of ssh_acceptor_sup for this port or new start after
+ %% ssh:stop_daemon
+ SupFlags = #{strategy => one_for_one,
+ intensity => 10,
+ period => 3600
+ },
+ ChildSpecs = [child_spec(Address, Port, Profile, Options)],
+ {ok, {SupFlags,ChildSpecs}}.
%%%=========================================================================
%%% Internal functions
%%%=========================================================================
child_spec(Address, Port, Profile, Options) ->
Timeout = ?GET_INTERNAL_OPT(timeout, Options, ?DEFAULT_TIMEOUT),
- Name = id(Address, Port, Profile),
- StartFunc = {ssh_acceptor, start_link, [Port, Address, Options, Timeout]},
- Restart = transient,
- Shutdown = brutal_kill,
- Modules = [ssh_acceptor],
- Type = worker,
- {Name, StartFunc, Restart, Shutdown, Type, Modules}.
+ #{id => id(Address, Port, Profile),
+ start => {ssh_acceptor, start_link, [Port, Address, Options, Timeout]},
+ restart => transient,
+ shutdown => brutal_kill,
+ type => worker,
+ modules => [ssh_acceptor]
+ }.
id(Address, Port, Profile) ->
{ssh_acceptor_sup, Address, Port, Profile}.