summaryrefslogtreecommitdiff
path: root/paramiko/sftp_file.py
diff options
context:
space:
mode:
authorAdam Meily <meily.adam@gmail.com>2015-12-17 20:18:00 -0500
committerAdam Meily <meily.adam@gmail.com>2015-12-17 20:18:00 -0500
commit9a87a8eb599d2b3914a3f3fcedbea8b25ab33d5a (patch)
tree9ca66cf1c5f262e55f5c9cf420d316a6f25d0a00 /paramiko/sftp_file.py
parent787839d3bc41cdd86905df6883b7de2b1bfb165a (diff)
parent844dda88ca1827ede2c3f73792facab7d28eef74 (diff)
downloadparamiko-9a87a8eb599d2b3914a3f3fcedbea8b25ab33d5a.tar.gz
Merge branch 'master' of github.com:paramiko/paramiko
Conflicts: paramiko/sftp_file.py sites/www/changelog.rst
Diffstat (limited to 'paramiko/sftp_file.py')
-rw-r--r--paramiko/sftp_file.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py
index 1d070ee0..3b584dbe 100644
--- a/paramiko/sftp_file.py
+++ b/paramiko/sftp_file.py
@@ -389,7 +389,7 @@ class SFTPFile (BufferedFile):
"""
self.pipelined = pipelined
- def prefetch(self):
+ def prefetch(self, file_size):
"""
Pre-fetch the remaining contents of this file in anticipation of future
`.read` calls. If reading the entire file, pre-fetching can
@@ -403,12 +403,11 @@ class SFTPFile (BufferedFile):
.. versionadded:: 1.5.1
"""
- size = self.stat().st_size
# queue up async reads for the rest of the file
chunks = []
n = self._realpos
- while n < size:
- chunk = min(self.MAX_REQUEST_SIZE, size - n)
+ while n < file_size:
+ chunk = min(self.MAX_REQUEST_SIZE, file_size - n)
chunks.append((n, chunk))
n += chunk
if len(chunks) > 0: