forked from LBRYCommunity/lbry-sdk
fix lbry id for dead contact to replace in _IterativeFindHelper
This commit is contained in:
parent
bbc960aaf9
commit
0b771c16ba
1 changed files with 4 additions and 3 deletions
|
@ -753,10 +753,11 @@ class _IterativeFindHelper(object):
|
|||
if testContact not in self.shortlist:
|
||||
self.shortlist.append(testContact)
|
||||
|
||||
def removeFromShortlist(self, failure):
|
||||
def removeFromShortlist(self, failure, deadContactID):
|
||||
""" @type failure: twisted.python.failure.Failure """
|
||||
failure.trap(protocol.TimeoutError)
|
||||
deadContactID = failure.getErrorMessage()
|
||||
if len(deadContactID) != constants.key_bits / 8:
|
||||
raise ValueError("invalid lbry id")
|
||||
if deadContactID in self.shortlist:
|
||||
self.shortlist.remove(deadContactID)
|
||||
return deadContactID
|
||||
|
@ -826,7 +827,7 @@ class _IterativeFindHelper(object):
|
|||
rpcMethod = getattr(contact, self.rpc)
|
||||
df = rpcMethod(self.key, rawResponse=True)
|
||||
df.addCallback(self.extendShortlist)
|
||||
df.addErrback(self.removeFromShortlist)
|
||||
df.addErrback(self.removeFromShortlist, contact.id)
|
||||
df.addCallback(self.cancelActiveProbe)
|
||||
df.addErrback(lambda _: log.exception('Failed to contact %s', contact))
|
||||
self.already_contacted.append(contact.id)
|
||||
|
|
Loading…
Reference in a new issue