From 2067e9a1368376f5ac7955874362679751562eca Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Mon, 1 May 2006 17:27:09 -0700 Subject: [PATCH] [project @ robey@lag.net-20060502002709-617a268779f7ca6b] readv should just yield results as it gets them (suggestion from robertc) --- paramiko/sftp_file.py | 4 +--- tests/test_sftp_big.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index 17f999e..2887986 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -388,11 +388,9 @@ class SFTPFile (BufferedFile): ordered_chunks.sort(lambda x, y: cmp(x[0], y[0])) self._start_prefetch(ordered_chunks) # now we can just devolve to a bunch of read()s :) - out = [] for x in chunks: self.seek(x[0]) - out.append(self.read(x[1])) - return out + yield self.read(x[1]) ### internals... diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py index aefe3ef..94edab0 100644 --- a/tests/test_sftp_big.py +++ b/tests/test_sftp_big.py @@ -232,7 +232,7 @@ class BigSFTPTest (unittest.TestCase): for i in xrange(len(readv_list)): offset = readv_list[i][0] n_offset = offset % 1024 - self.assertEqual(ret[i], k2blob[n_offset:n_offset + chunk]) + self.assertEqual(ret.next(), k2blob[n_offset:n_offset + chunk]) f.close() end = time.time() sys.stderr.write('%ds ' % round(end - start))