diff options
author | Ingela Anderton Andin <[email protected]> | 2012-02-28 10:29:24 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-02-28 10:29:24 +0100 |
commit | bc50e697fbf392c99842d823eb67a564e1759376 (patch) | |
tree | ccf3969614c01cf2b2c24f2942529ccb570bf096 /lib/ssh/src/sshc_sup.erl | |
parent | d9ee75fa3df8676deb92136c38b65e928cde196e (diff) | |
parent | 1aeb8f4234b52705f9a933abf8dcd1afb2296b9d (diff) | |
download | otp-bc50e697fbf392c99842d823eb67a564e1759376.tar.gz otp-bc50e697fbf392c99842d823eb67a564e1759376.tar.bz2 otp-bc50e697fbf392c99842d823eb67a564e1759376.zip |
Merge branch 'ia/ssh/error-handling' into maint
* ia/ssh/error-handling:
Prevent client hanging. (OTP-8111)
Added checks of API input
Improve check so that we will not try to read ssh packet length indicator if not sure we have enough data.
Improved error handling
Diffstat (limited to 'lib/ssh/src/sshc_sup.erl')
-rw-r--r-- | lib/ssh/src/sshc_sup.erl | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/ssh/src/sshc_sup.erl b/lib/ssh/src/sshc_sup.erl index 7c29c669e4..1d2779de23 100644 --- a/lib/ssh/src/sshc_sup.erl +++ b/lib/ssh/src/sshc_sup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. 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 @@ -26,7 +26,7 @@ -behaviour(supervisor). --export([start_link/1, start_child/1]). +-export([start_link/1, start_child/1, stop_child/1]). %% Supervisor callback -export([init/1]). @@ -40,12 +40,19 @@ start_link(Args) -> start_child(Args) -> supervisor:start_child(?MODULE, Args). +stop_child(Client) -> + spawn(fun() -> + ClientSup = whereis(?MODULE), + supervisor:terminate_child(ClientSup, Client) + end), + ok. + %%%========================================================================= %%% Supervisor callback %%%========================================================================= init(Args) -> RestartStrategy = simple_one_for_one, - MaxR = 10, + MaxR = 0, MaxT = 3600, {ok, {{RestartStrategy, MaxR, MaxT}, [child_spec(Args)]}}. @@ -54,12 +61,9 @@ init(Args) -> %%%========================================================================= child_spec(_) -> Name = undefined, % As simple_one_for_one is used. - StartFunc = {ssh_connection_controler, start_link, []}, - Restart = temporary, -% Shutdown = infinity, - Shutdown = 5000, - Modules = [ssh_connection_controler], -% Type = supervisor, - Type = worker, + StartFunc = {ssh_connection_sup, start_link, []}, + Restart = temporary, + Shutdown = infinity, + Modules = [ssh_connection_sup], + Type = supervisor, {Name, StartFunc, Restart, Shutdown, Type, Modules}. - |