]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Fix a bug in Downloader._scan_remote that incorrectly skips subsequent files
authorDaira Hopwood <daira@jacaranda.org>
Thu, 20 Aug 2015 18:45:49 +0000 (19:45 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Thu, 1 Oct 2015 00:19:47 +0000 (01:19 +0100)
(and drops a Deferred) when local version >= remote version.
Also simplify that code and robustify it for the case where the version metadata is missing.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py

index ff77adcb6b420596d49523186bda2938678b2251..336d94248f2ef0570cdb742c044c41a1a3c63e9f 100644 (file)
@@ -459,23 +459,18 @@ class Downloader(QueueMixin):
             self._download_scan_batch[name] = [(file_node, metadata)]
 
     def _scan_remote(self, nickname, dirnode):
-        listing_d = dirnode.list()
+        d = dirnode.list()
         def scan_listing(listing_map):
             for name in listing_map.keys():
                 file_node, metadata = listing_map[name]
                 local_version = self._get_local_latest(name) # XXX we might need to convert first?
-                if local_version is not None:
-                    if local_version >= metadata['version']:
-                        print "local version greater than or equal to remote"
-                        return None
-                    else:
-                        print "local version less than remote"
-                        self._append_to_batch(name, file_node, metadata)
-                else:
+                remote_version = metadata.get('version', None)
+                print "%r has local version %r, remote version %r" % (name, local_version, remote_version)
+                if local_version is None or remote_version is None or local_version < remote_version:
                     self._append_to_batch(name, file_node, metadata)
 
-        listing_d.addCallback(scan_listing)
-        return listing_d
+        d.addCallback(scan_listing)
+        return d
 
     def _scan_remote_collective(self):
         self._download_scan_batch = {} # XXX