summaryrefslogtreecommitdiff
path: root/lib/ssh/src/ssh_system_sup.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ssh/src/ssh_system_sup.erl')
-rw-r--r--lib/ssh/src/ssh_system_sup.erl18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_system_sup.erl b/lib/ssh/src/ssh_system_sup.erl
index 3298fd1158..704c17c4e7 100644
--- a/lib/ssh/src/ssh_system_sup.erl
+++ b/lib/ssh/src/ssh_system_sup.erl
@@ -37,11 +37,16 @@
subsystem_supervisor/1, channel_supervisor/1,
connection_supervisor/1,
acceptor_supervisor/1, start_subsystem/6,
- stop_subsystem/2]).
+ stop_subsystem/2,
+ get_options/4
+ ]).
%% Supervisor callback
-export([init/1]).
+-define(START(Address, Port, Profile, Options),
+ {ssh_acceptor_sup, start_link, [Address, Port, Profile, Options]}).
+
%%%=========================================================================
%%% API
%%%=========================================================================
@@ -61,7 +66,7 @@ init([server, Address, Port, Profile, Options]) ->
case ?GET_INTERNAL_OPT(connected_socket,Options,undefined) of
undefined ->
[#{id => id(ssh_acceptor_sup, Address, Port, Profile),
- start => {ssh_acceptor_sup, start_link, [Address, Port, Profile, Options]},
+ start => ?START(Address,Port,Profile,Options),
restart => transient,
type => supervisor
}];
@@ -103,6 +108,15 @@ stop_system(server, Address, Port, Profile) ->
ok.
+get_options(Sup, Address, Port, Profile) ->
+ try
+ {ok, #{start:=?START(Address,Port,Profile,Options)}} =
+ supervisor:get_childspec(Sup, id(ssh_acceptor_sup,Address,Port,Profile)),
+ {ok, Options}
+ catch
+ _:_ -> {error,not_found}
+ end.
+
system_supervisor(Address, Port, Profile) ->
Name = make_name(Address, Port, Profile),
whereis(Name).