aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiclas Eklund <[email protected]>2010-12-27 14:56:05 +0100
committerNiclas Eklund <[email protected]>2010-12-27 14:56:05 +0100
commitd9e039164f2eb1dce7b37e24371d1be8d82b6c92 (patch)
treef0fbe57afd72250625531e3164ed4d6712f6db6b
parent264e7630339604f9113c57b99216f7cf35768580 (diff)
downloadotp-d9e039164f2eb1dce7b37e24371d1be8d82b6c92.tar.gz
otp-d9e039164f2eb1dce7b37e24371d1be8d82b6c92.tar.bz2
otp-d9e039164f2eb1dce7b37e24371d1be8d82b6c92.zip
Improved error handling for ssh:connect/3/4.
-rw-r--r--lib/ssh/src/ssh.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl
index b7f56b1b38..cada109df0 100644
--- a/lib/ssh/src/ssh.erl
+++ b/lib/ssh/src/ssh.erl
@@ -96,13 +96,17 @@ connect(Host, Port, Options, Timeout) ->
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} when Reason == normal ->
- {error, channel_closed};
{'EXIT', Manager, _What} ->
- {error, Reason}
+ {error, channel_closed}
after 0 ->
- {error, Reason}
+ {error, channel_closed}
end
after Timeout ->
do_demonitor(MRef, Manager),