aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2012-08-29 09:47:55 +0200
committerIngela Anderton Andin <[email protected]>2012-08-29 09:47:55 +0200
commit51f7937ef20f1b577223cef9c95a28c3bfdffbfa (patch)
tree5d9f790a969abb71ef70de546c997a2ff840b1e4 /lib/ssh/src/ssh.erl
parent479784883bfddb31c47b900ab03f03fc83f05970 (diff)
parent0080be4a20c094ef45dde842ace64f16d5dc22b2 (diff)
downloadotp-51f7937ef20f1b577223cef9c95a28c3bfdffbfa.tar.gz
otp-51f7937ef20f1b577223cef9c95a28c3bfdffbfa.tar.bz2
otp-51f7937ef20f1b577223cef9c95a28c3bfdffbfa.zip
Merge remote branch 'upstream/maint'
* upstream/maint: ssh: Prepare for release ssh: Correct error handling of ssh connect ssh: Use the correct channel id when adjusting the channel window
Diffstat (limited to 'lib/ssh/src/ssh.erl')
-rw-r--r--lib/ssh/src/ssh.erl31
1 files changed, 1 insertions, 30 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl
index 85f5f680e6..3395f73884 100644
--- a/lib/ssh/src/ssh.erl
+++ b/lib/ssh/src/ssh.erl
@@ -91,10 +91,8 @@ do_connect(Host, Port, SocketOptions, SshOptions, Timeout, DisableIpv6) ->
{ok, ConnectionSup} ->
{ok, Manager} =
ssh_connection_sup:connection_manager(ConnectionSup),
- MRef = erlang:monitor(process, Manager),
receive
{Manager, is_connected} ->
- do_demonitor(MRef, Manager),
{ok, Manager};
%% When the connection fails
%% ssh_connection_sup:connection_manager
@@ -102,30 +100,13 @@ do_connect(Host, Port, SocketOptions, SshOptions, Timeout, DisableIpv6) ->
%% could allready have terminated, so we will not
%% match the Manager in this case
{_, not_connected, {error, econnrefused}} when DisableIpv6 == false ->
- do_demonitor(MRef, Manager),
do_connect(Host, Port, proplists:delete(inet6, SocketOptions),
SshOptions, Timeout, true);
{_, not_connected, {error, Reason}} ->
- do_demonitor(MRef, Manager),
{error, Reason};
{_, not_connected, Other} ->
- do_demonitor(MRef, Manager),
- {error, Other};
- {'DOWN', MRef, _, Manager, Reason} when is_pid(Manager) ->
- error_logger:warning_report([{ssh, connect},
- {diagnose,
- "Connection was closed before properly set up."},
- {host, Host},
- {port, Port},
- {reason, Reason}]),
- receive %% Clear EXIT message from queue
- {'EXIT', Manager, _What} ->
- {error, channel_closed}
- after 0 ->
- {error, channel_closed}
- end
+ {error, Other}
after Timeout ->
- do_demonitor(MRef, Manager),
ssh_connection_manager:stop(Manager),
{error, timeout}
end
@@ -134,16 +115,6 @@ do_connect(Host, Port, SocketOptions, SshOptions, Timeout, DisableIpv6) ->
{error, ssh_not_started}
end.
-do_demonitor(MRef, Manager) ->
- erlang:demonitor(MRef),
- receive
- {'DOWN', MRef, _, Manager, _} ->
- ok
- after 0 ->
- ok
- end.
-
-
%%--------------------------------------------------------------------
%% Function: close(ConnectionRef) -> ok
%%