diff options
author | Hans Nilsson <[email protected]> | 2017-03-23 16:53:53 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2017-04-07 10:23:35 +0200 |
commit | 8f4bb9b0bd3aed663521371726ea3ec460e231a0 (patch) | |
tree | 78957c1854efbe5c556a1f2ef99dcbc72a3ac81a /lib/ssh/src/ssh_subsystem_sup.erl | |
parent | 6158cb432092c47e178b4dc1177b46cb8c310ab4 (diff) | |
download | otp-8f4bb9b0bd3aed663521371726ea3ec460e231a0.tar.gz otp-8f4bb9b0bd3aed663521371726ea3ec460e231a0.tar.bz2 otp-8f4bb9b0bd3aed663521371726ea3ec460e231a0.zip |
ssh: Mappify supervisors
Diffstat (limited to 'lib/ssh/src/ssh_subsystem_sup.erl')
-rw-r--r-- | lib/ssh/src/ssh_subsystem_sup.erl | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/ssh/src/ssh_subsystem_sup.erl b/lib/ssh/src/ssh_subsystem_sup.erl index c5ab422265..cf409ade6b 100644 --- a/lib/ssh/src/ssh_subsystem_sup.erl +++ b/lib/ssh/src/ssh_subsystem_sup.erl @@ -54,11 +54,12 @@ channel_supervisor(SupPid) -> %%% Supervisor callback %%%========================================================================= init([Role, Address, Port, Profile, Options]) -> - RestartStrategy = one_for_all, - MaxR = 0, - MaxT = 3600, - Children = child_specs(Role, Address, Port, Profile, Options), - {ok, {{RestartStrategy, MaxR, MaxT}, Children}}. + SupFlags = #{strategy => one_for_all, + intensity => 0, + period => 3600 + }, + ChildSpecs = child_specs(Role, Address, Port, Profile, Options), + {ok, {SupFlags,ChildSpecs}}. %%%========================================================================= %%% Internal functions @@ -70,22 +71,22 @@ child_specs(server, Address, Port, Profile, Options) -> ssh_connection_child_spec(server, Address, Port, Profile, Options)]. ssh_connection_child_spec(Role, Address, Port, _Profile, Options) -> - Name = id(Role, ssh_connection_sup, Address, Port), - StartFunc = {ssh_connection_sup, start_link, [Options]}, - Restart = temporary, - Shutdown = 5000, - Modules = [ssh_connection_sup], - Type = supervisor, - {Name, StartFunc, Restart, Shutdown, Type, Modules}. + #{id => id(Role, ssh_connection_sup, Address, Port), + start => {ssh_connection_sup, start_link, [Options]}, + restart => temporary, + shutdown => 5000, + type => supervisor, + modules => [ssh_connection_sup] + }. ssh_channel_child_spec(Role, Address, Port, _Profile, Options) -> - Name = id(Role, ssh_channel_sup, Address, Port), - StartFunc = {ssh_channel_sup, start_link, [Options]}, - Restart = temporary, - Shutdown = infinity, - Modules = [ssh_channel_sup], - Type = supervisor, - {Name, StartFunc, Restart, Shutdown, Type, Modules}. + #{id => id(Role, ssh_channel_sup, Address, Port), + start => {ssh_channel_sup, start_link, [Options]}, + restart => temporary, + shutdown => infinity, + type => supervisor, + modules => [ssh_channel_sup] + }. id(Role, Sup, Address, Port) -> {Role, Sup, Address, Port}. |