Minor typo fixes in the Peer manager.
[quix0rs-apt-p2p.git] / apt_p2p / PeerManager.py
index 9bf4b4dbfd31144787a1064cdb0c310b186f4270..dd39e41da1dbf8d9176a9c9035b2898fa8061a01 100644 (file)
@@ -333,7 +333,7 @@ class FileDownload:
                     break
         elif max_found == max(pieces_dl_hash.values()):
             # Large number of pieces stored in peers
-            for pieces, num in pieces_hash.items():
+            for pieces, num in pieces_dl_hash.items():
                 # Find the most popular piece hash to download
                 if num == max_found:
                     log.msg('Found a hash for pieces to lookup in peers: %r' % pieces)
@@ -407,7 +407,7 @@ class FileDownload:
                         break
         
         log.msg('Done sending piece hash requests for now, %d outstanding' % self.outstanding)
-        if self.pieces is None and self.outstanding == 0:
+        if self.pieces is None and self.outstanding <= 0:
             # Continue without the piece hashes
             log.msg('Could not retrieve the piece hashes from the peers')
             self.pieces = []