skip on invalid received hash ids

This commit is contained in:
shortcutme 2018-01-19 02:20:20 +01:00
parent fd451ae766
commit 814fa881d0
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -288,7 +288,7 @@ class Peer(object):
# Return: {hash1: ["ip:port", "ip:port",...],...} # Return: {hash1: ["ip:port", "ip:port",...],...}
def findHashIds(self, hash_ids): def findHashIds(self, hash_ids):
res = self.request("findHashIds", {"site": self.site.address, "hash_ids": hash_ids}) res = self.request("findHashIds", {"site": self.site.address, "hash_ids": hash_ids})
if not res or "error" in res: if not res or "error" in res or type(res) is not dict:
return False return False
# Unpack IP4 # Unpack IP4
back = {key: map(helper.unpackAddress, val) for key, val in res["peers"].items()[0:30]} back = {key: map(helper.unpackAddress, val) for key, val in res["peers"].items()[0:30]}