aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_subsystem_sup.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssh/src/ssh_subsystem_sup.erl')
-rw-r--r--lib/ssh/src/ssh_subsystem_sup.erl36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/ssh/src/ssh_subsystem_sup.erl b/lib/ssh/src/ssh_subsystem_sup.erl
index 637f5f398f..cf82db458f 100644
--- a/lib/ssh/src/ssh_subsystem_sup.erl
+++ b/lib/ssh/src/ssh_subsystem_sup.erl
@@ -26,6 +26,8 @@
-behaviour(supervisor).
+-include("ssh.hrl").
+
-export([start_link/1,
connection_supervisor/1,
channel_supervisor/1
@@ -37,8 +39,8 @@
%%%=========================================================================
%%% API
%%%=========================================================================
-start_link(Opts) ->
- supervisor:start_link(?MODULE, [Opts]).
+start_link(Options) ->
+ supervisor:start_link(?MODULE, [Options]).
connection_supervisor(SupPid) ->
Children = supervisor:which_children(SupPid),
@@ -53,42 +55,42 @@ channel_supervisor(SupPid) ->
%%%=========================================================================
-spec init( [term()] ) -> {ok,{supervisor:sup_flags(),[supervisor:child_spec()]}} | ignore .
-init([Opts]) ->
+init([Options]) ->
RestartStrategy = one_for_all,
MaxR = 0,
MaxT = 3600,
- Children = child_specs(Opts),
+ Children = child_specs(Options),
{ok, {{RestartStrategy, MaxR, MaxT}, Children}}.
%%%=========================================================================
%%% Internal functions
%%%=========================================================================
-child_specs(Opts) ->
- case proplists:get_value(role, Opts) of
+child_specs(Options) ->
+ case ?GET_INTERNAL_OPT(role, Options) of
client ->
[];
server ->
- [ssh_channel_child_spec(Opts), ssh_connectinon_child_spec(Opts)]
+ [ssh_channel_child_spec(Options), ssh_connectinon_child_spec(Options)]
end.
-ssh_connectinon_child_spec(Opts) ->
- Address = proplists:get_value(address, Opts),
- Port = proplists:get_value(port, Opts),
- Role = proplists:get_value(role, Opts),
+ssh_connectinon_child_spec(Options) ->
+ Address = ?GET_INTERNAL_OPT(address, Options),
+ Port = ?GET_INTERNAL_OPT(port, Options),
+ Role = ?GET_INTERNAL_OPT(role, Options),
Name = id(Role, ssh_connection_sup, Address, Port),
- StartFunc = {ssh_connection_sup, start_link, [Opts]},
+ StartFunc = {ssh_connection_sup, start_link, [Options]},
Restart = temporary,
Shutdown = 5000,
Modules = [ssh_connection_sup],
Type = supervisor,
{Name, StartFunc, Restart, Shutdown, Type, Modules}.
-ssh_channel_child_spec(Opts) ->
- Address = proplists:get_value(address, Opts),
- Port = proplists:get_value(port, Opts),
- Role = proplists:get_value(role, Opts),
+ssh_channel_child_spec(Options) ->
+ Address = ?GET_INTERNAL_OPT(address, Options),
+ Port = ?GET_INTERNAL_OPT(port, Options),
+ Role = ?GET_INTERNAL_OPT(role, Options),
Name = id(Role, ssh_channel_sup, Address, Port),
- StartFunc = {ssh_channel_sup, start_link, [Opts]},
+ StartFunc = {ssh_channel_sup, start_link, [Options]},
Restart = temporary,
Shutdown = infinity,
Modules = [ssh_channel_sup],