aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_xfer.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-01-14 10:39:17 +0100
committerHans Nilsson <[email protected]>2016-01-18 12:21:26 +0100
commit1bb8e4ae6eaf2f18d3b2ccc8e77cd7228e1c6e8a (patch)
treebde95c5179380e2e779d70967ec3d204a47afa68 /lib/ssh/src/ssh_xfer.erl
parentb9b704f8b584994cbbb4975133d6032d5d0d294e (diff)
downloadotp-1bb8e4ae6eaf2f18d3b2ccc8e77cd7228e1c6e8a.tar.gz
otp-1bb8e4ae6eaf2f18d3b2ccc8e77cd7228e1c6e8a.tar.bz2
otp-1bb8e4ae6eaf2f18d3b2ccc8e77cd7228e1c6e8a.zip
ssh: Experimental options for ssh_sftp:start_channel to set packet_size or window_size
Diffstat (limited to 'lib/ssh/src/ssh_xfer.erl')
-rw-r--r--lib/ssh/src/ssh_xfer.erl22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/ssh/src/ssh_xfer.erl b/lib/ssh/src/ssh_xfer.erl
index b8dff1c533..e7dd8e7098 100644
--- a/lib/ssh/src/ssh_xfer.erl
+++ b/lib/ssh/src/ssh_xfer.erl
@@ -24,7 +24,7 @@
-module(ssh_xfer).
--export([attach/2, connect/3, connect/4]).
+-export([attach/2, attach/3, connect/3, connect/4, connect/5]).
-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,
@@ -51,24 +51,34 @@
-define(XFER_WINDOW_SIZE, 4*?XFER_PACKET_SIZE).
attach(CM, Opts) ->
- open_xfer(CM, Opts).
+ open_xfer(CM, Opts, []).
+
+attach(CM, Opts, ChanOpts) ->
+ open_xfer(CM, Opts, ChanOpts).
+
connect(Host, Port, Opts) ->
case ssh:connect(Host, Port, Opts) of
- {ok, CM} -> open_xfer(CM, Opts);
+ {ok, CM} -> open_xfer(CM, Opts, []);
Error -> Error
end.
connect(Host, Port, Opts, Timeout) ->
+ connect(Host, Port, Opts, [], Timeout).
+
+connect(Host, Port, Opts, ChanOpts, Timeout) ->
case ssh:connect(Host, Port, Opts, Timeout) of
- {ok, CM} -> open_xfer(CM, [{timeout, Timeout}|Opts]);
+ {ok, CM} -> open_xfer(CM, [{timeout, Timeout}|Opts], ChanOpts);
{error, Timeout} -> {error, timeout};
Error -> Error
end.
-open_xfer(CM, Opts) ->
+
+open_xfer(CM, Opts, ChanOpts) ->
TMO = proplists:get_value(timeout, Opts, infinity),
- case ssh_connection:session_channel(CM, ?XFER_WINDOW_SIZE, ?XFER_PACKET_SIZE, TMO) of
+ WindowSize = proplists:get_value(window_size, ChanOpts, ?XFER_WINDOW_SIZE),
+ PacketSize = proplists:get_value(packet_size, ChanOpts, ?XFER_PACKET_SIZE),
+ case ssh_connection:session_channel(CM, WindowSize, PacketSize, TMO) of
{ok, ChannelId} ->
{ok, ChannelId, CM};
Error ->