diff options
author | Niclas Eklund <[email protected]> | 2010-12-10 17:00:02 +0100 |
---|---|---|
committer | Niclas Eklund <[email protected]> | 2010-12-10 17:00:02 +0100 |
commit | 8bd0325c850ad70e514f680a2dd7020144773665 (patch) | |
tree | 9d8ad2b52391cb54db7fef5c84d0b519c1d48c34 /lib/ssh/src/ssh_system_sup.erl | |
parent | 3cf40cefd44ab6383bd16319c7c6941fd0d0f13c (diff) | |
parent | caa311d4a2b5fb229d9369c7667b062b34945b36 (diff) | |
download | otp-8bd0325c850ad70e514f680a2dd7020144773665.tar.gz otp-8bd0325c850ad70e514f680a2dd7020144773665.tar.bz2 otp-8bd0325c850ad70e514f680a2dd7020144773665.zip |
Merge branch 'maint-r13' of super:otp into nick/orber/recursive_types/OTP-8868
Diffstat (limited to 'lib/ssh/src/ssh_system_sup.erl')
-rw-r--r-- | lib/ssh/src/ssh_system_sup.erl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_system_sup.erl b/lib/ssh/src/ssh_system_sup.erl index 477f60f993..d1003e12f2 100644 --- a/lib/ssh/src/ssh_system_sup.erl +++ b/lib/ssh/src/ssh_system_sup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -33,7 +33,8 @@ stop_system/2, system_supervisor/2, subsystem_supervisor/1, channel_supervisor/1, connection_supervisor/1, - acceptor_supervisor/1, start_subsystem/2, restart_subsystem/2, restart_acceptor/2]). + acceptor_supervisor/1, start_subsystem/2, restart_subsystem/2, + restart_acceptor/2, stop_subsystem/2]). %% Supervisor callback -export([init/1]). @@ -83,6 +84,23 @@ start_subsystem(SystemSup, Options) -> Spec = ssh_subsystem_child_spec(Options), supervisor:start_child(SystemSup, Spec). +stop_subsystem(SystemSup, SubSys) -> + case catch lists:keyfind(SubSys, 2, supervisor:which_children(SystemSup)) of + false -> + {error, not_found}; + {Id, _, _, _} -> + spawn(fun() -> supervisor:terminate_child(SystemSup, Id), + supervisor:delete_child(SystemSup, Id) end), + ok; + {'EXIT', {noproc, _}} -> + %% Already terminated; probably shutting down. + ok; + {'EXIT', {shutdown, _}} -> + %% Already shutting down. + ok + end. + + restart_subsystem(Address, Port) -> SysSupName = make_name(Address, Port), SubSysName = id(ssh_subsystem_sup, Address, Port), |