diff options
author | Ingela Anderton Andin <[email protected]> | 2012-08-29 09:46:30 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-08-29 09:46:30 +0200 |
commit | e3771bad2cc69658309c88cc4db132f0586933a0 (patch) | |
tree | e69be3fea728c5187ba973ddd94c94aac4d099ca /lib/ssh/src/ssh_connection_sup.erl | |
parent | d6853735d2f853cc9186a48c6e7964a5bee9a68d (diff) | |
parent | b9a7003314280a22ea145758542b6a96c75a139a (diff) | |
download | otp-e3771bad2cc69658309c88cc4db132f0586933a0.tar.gz otp-e3771bad2cc69658309c88cc4db132f0586933a0.tar.bz2 otp-e3771bad2cc69658309c88cc4db132f0586933a0.zip |
Merge branch 'ia/ssh/connection-start-error-handling' into maint
* ia/ssh/connection-start-error-handling:
ssh: Correct error handling of ssh connect
Diffstat (limited to 'lib/ssh/src/ssh_connection_sup.erl')
-rw-r--r-- | lib/ssh/src/ssh_connection_sup.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_sup.erl b/lib/ssh/src/ssh_connection_sup.erl index e3544af1c6..b620056310 100644 --- a/lib/ssh/src/ssh_connection_sup.erl +++ b/lib/ssh/src/ssh_connection_sup.erl @@ -48,8 +48,12 @@ start_manager_child(Sup, Args) -> supervisor:start_child(Sup, Spec). connection_manager(SupPid) -> - Children = supervisor:which_children(SupPid), - {ok, ssh_connection_manager(Children)}. + try supervisor:which_children(SupPid) of + Children -> + {ok, ssh_connection_manager(Children)} + catch exit:{noproc,_} -> + {ok, undefined} + end. %%%========================================================================= %%% Supervisor callback @@ -107,6 +111,8 @@ handler_spec([Role, Socket, Opts]) -> Type = worker, {Name, StartFunc, Restart, Shutdown, Type, Modules}. +ssh_connection_manager([]) -> + undefined; ssh_connection_manager([{_, Child, _, [ssh_connection_manager]} | _]) -> Child; ssh_connection_manager([_ | Rest]) -> |