forked from LBRYCommunity/lbry-sdk
put back all the peers, get rid of re_add
This commit is contained in:
parent
c96d1d9c32
commit
bb60c385d5
1 changed files with 2 additions and 8 deletions
|
@ -97,20 +97,14 @@ class BlobDownloader:
|
||||||
"%s running, %d peers, %d ignored, %d active, %s connections", blob_hash[:6],
|
"%s running, %d peers, %d ignored, %d active, %s connections", blob_hash[:6],
|
||||||
len(batch), len(self.ignored), len(self.active_connections), len(self.connections)
|
len(batch), len(self.ignored), len(self.active_connections), len(self.connections)
|
||||||
)
|
)
|
||||||
re_add: typing.Set['KademliaPeer'] = set()
|
|
||||||
for peer in sorted(batch, key=lambda peer: self.scores.get(peer, 0), reverse=True):
|
for peer in sorted(batch, key=lambda peer: self.scores.get(peer, 0), reverse=True):
|
||||||
if peer in self.ignored:
|
if peer in self.ignored:
|
||||||
continue
|
continue
|
||||||
if peer in self.active_connections:
|
if peer in self.active_connections or not self.should_race_continue(blob):
|
||||||
if peer not in re_add:
|
|
||||||
re_add.add(peer)
|
|
||||||
continue
|
continue
|
||||||
if not self.should_race_continue(blob):
|
|
||||||
break
|
|
||||||
log.debug("request %s from %s:%i", blob_hash[:8], peer.address, peer.tcp_port)
|
log.debug("request %s from %s:%i", blob_hash[:8], peer.address, peer.tcp_port)
|
||||||
t = self.loop.create_task(self.request_blob_from_peer(blob, peer, connection_id))
|
t = self.loop.create_task(self.request_blob_from_peer(blob, peer, connection_id))
|
||||||
self.active_connections[peer] = t
|
self.active_connections[peer] = t
|
||||||
if not re_add:
|
|
||||||
self.peer_queue.put_nowait(list(batch))
|
self.peer_queue.put_nowait(list(batch))
|
||||||
await self.new_peer_or_finished()
|
await self.new_peer_or_finished()
|
||||||
self.cleanup_active()
|
self.cleanup_active()
|
||||||
|
|
Loading…
Reference in a new issue