forked from LBRYCommunity/lbry-sdk
small adjustment to new_peer_or_finished
This commit is contained in:
parent
63bd983012
commit
60f7766cf7
1 changed files with 2 additions and 3 deletions
|
@ -57,14 +57,13 @@ class BlobDownloader:
|
||||||
del self.connections[peer]
|
del self.connections[peer]
|
||||||
elif transport:
|
elif transport:
|
||||||
log.debug("keep peer %s:%i", peer.address, peer.tcp_port)
|
log.debug("keep peer %s:%i", peer.address, peer.tcp_port)
|
||||||
if bytes_received:
|
self.failures[peer] = 0
|
||||||
self.failures[peer] = 0
|
|
||||||
self.connections[peer] = transport
|
self.connections[peer] = transport
|
||||||
rough_speed = (bytes_received / (self.loop.time() - start)) if bytes_received else 0
|
rough_speed = (bytes_received / (self.loop.time() - start)) if bytes_received else 0
|
||||||
self.scores[peer] = rough_speed
|
self.scores[peer] = rough_speed
|
||||||
|
|
||||||
async def new_peer_or_finished(self):
|
async def new_peer_or_finished(self):
|
||||||
active_tasks = list(self.active_connections.values()) + [asyncio.sleep(0.2)]
|
active_tasks = list(self.active_connections.values()) + [asyncio.sleep(1)]
|
||||||
await asyncio.wait(active_tasks, loop=self.loop, return_when='FIRST_COMPLETED')
|
await asyncio.wait(active_tasks, loop=self.loop, return_when='FIRST_COMPLETED')
|
||||||
|
|
||||||
def cleanup_active(self):
|
def cleanup_active(self):
|
||||||
|
|
Loading…
Reference in a new issue