diff options
author | Erlang/OTP <[email protected]> | 2014-09-29 08:59:49 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2014-09-29 08:59:49 +0200 |
commit | e218a4578f0ea24fb846ee433d48df98040ff573 (patch) | |
tree | bf3ce7b7f86235450e5267e43632ef4c116be1b0 /lib/ssh/src/ssh.erl | |
parent | ee4af1e0736f0ae1661fecd63c05c24c4067e4ea (diff) | |
parent | 19aa8b2e1e11f1da4723dbcce427831eca17d54e (diff) | |
download | otp-e218a4578f0ea24fb846ee433d48df98040ff573.tar.gz otp-e218a4578f0ea24fb846ee433d48df98040ff573.tar.bz2 otp-e218a4578f0ea24fb846ee433d48df98040ff573.zip |
Merge branch 'ia/ssh/listner-restart/OTP-12168' into maint-17
* ia/ssh/listner-restart/OTP-12168:
ssh: Adjust supervisor tree to make sure new listning options are honored
ssh: Add test case for ssh:stop_listner
Diffstat (limited to 'lib/ssh/src/ssh.erl')
-rw-r--r-- | lib/ssh/src/ssh.erl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 8a8d4bb89e..de047d3c83 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -234,22 +234,26 @@ do_start_daemon(Host, Port, Options, SocketOptions) -> {port, Port}, {role, server}, {socket_opts, SocketOptions}, {ssh_opts, Options}]) of - {ok, SysSup} -> - {ok, SysSup}; {error, {already_started, _}} -> {error, eaddrinuse}; - {error, R} -> - {error, R} + Result = {Code, _} when (Code == ok) or (Code == error) -> + Result catch exit:{noproc, _} -> {error, ssh_not_started} end; Sup -> - case ssh_system_sup:restart_acceptor(Host, Port) of + AccPid = ssh_system_sup:acceptor_supervisor(Sup), + case ssh_acceptor_sup:start_child(AccPid, [{address, Host}, + {port, Port}, {role, server}, + {socket_opts, SocketOptions}, + {ssh_opts, Options}]) of + {error, {already_started, _}} -> + {error, eaddrinuse}; {ok, _} -> {ok, Sup}; - _ -> - {error, eaddrinuse} + Other -> + Other end end. |