diff options
author | Robey Pointer <robey@lag.net> | 2006-03-26 16:19:36 -0800 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2006-03-26 16:19:36 -0800 |
commit | d7b28ac257caf5daa2bd673efff9350bf547de38 (patch) | |
tree | c7e36fc952365b6d2340f560569172bccb7aa459 | |
parent | 0cee90eeca1c421ee1fa7078df7b91db13ecc032 (diff) |
[project @ robey@lag.net-20060327001936-9dd7d3b155614bbf]
allow multiple prefetches to happen in rapid succession
-rw-r--r-- | paramiko/sftp_file.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index 8f8dbfc5..a56b148a 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -47,6 +47,7 @@ class SFTPFile (BufferedFile): self._prefetch_done = False self._prefetch_so_far = 0 self._prefetch_data = {} + self._prefetch_reads = [] self._saved_exception = None def __del__(self): @@ -380,6 +381,7 @@ class SFTPFile (BufferedFile): """ # put the offsets in order, since we depend on that for determining # when the reads have finished. + self.sftp._log(DEBUG, 'readv(%s, %r)' % (util.hexify(self.handle), chunks)) ordered_chunks = chunks[:] ordered_chunks.sort(lambda x, y: cmp(x[0], y[0])) self._start_prefetch(ordered_chunks) @@ -405,7 +407,7 @@ class SFTPFile (BufferedFile): self._prefetch_done = False self._prefetch_so_far = chunks[0][0] self._prefetch_data = {} - self._prefetch_reads = chunks[:] + self._prefetch_reads.extend(chunks[:]) t = threading.Thread(target=self._prefetch_thread, args=(chunks,)) t.setDaemon(True) |