aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_xfer.erl
diff options
context:
space:
mode:
authorMarcus Arendt <[email protected]>2014-11-12 10:03:45 +0100
committerMarcus Arendt <[email protected]>2014-11-12 10:03:45 +0100
commite61f384adff0c9b134750ee239581296d25c10cd (patch)
tree49943be69110215a353b8a0c2f68b47098d93ee1 /lib/ssh/src/ssh_xfer.erl
parente38e7f9bd7756037c9c42a4d97278fead0402629 (diff)
parentc854951a2bae920f4c1e4fd4073bc2ac69d5a3a9 (diff)
downloadotp-e61f384adff0c9b134750ee239581296d25c10cd.tar.gz
otp-e61f384adff0c9b134750ee239581296d25c10cd.tar.bz2
otp-e61f384adff0c9b134750ee239581296d25c10cd.zip
Merge branch 'dotsimon/ssh_connect_timeout/OTP-12306' into maint
* dotsimon/ssh_connect_timeout/OTP-12306: Fix ssh_sftp:start_channel timeout
Diffstat (limited to 'lib/ssh/src/ssh_xfer.erl')
-rw-r--r--lib/ssh/src/ssh_xfer.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh_xfer.erl b/lib/ssh/src/ssh_xfer.erl
index 1881392db8..2743b704f1 100644
--- a/lib/ssh/src/ssh_xfer.erl
+++ b/lib/ssh/src/ssh_xfer.erl
@@ -23,7 +23,7 @@
-module(ssh_xfer).
--export([attach/2, connect/3]).
+-export([attach/2, connect/3, connect/4]).
-export([open/6, opendir/3, readdir/3, close/3, read/5, write/5,
rename/5, remove/3, mkdir/4, rmdir/3, realpath/3, extended/4,
stat/4, fstat/4, lstat/4, setstat/4,
@@ -58,6 +58,13 @@ connect(Host, Port, Opts) ->
Error -> Error
end.
+connect(Host, Port, Opts, Timeout) ->
+ case ssh:connect(Host, Port, Opts, Timeout) of
+ {ok, CM} -> open_xfer(CM, [{timeout, Timeout}|Opts]);
+ {error, Timeout} -> {error, timeout};
+ Error -> Error
+ end.
+
open_xfer(CM, Opts) ->
TMO = proplists:get_value(timeout, Opts, infinity),
case ssh_connection:session_channel(CM, ?XFER_WINDOW_SIZE, ?XFER_PACKET_SIZE, TMO) of