Limit bootstrap queries to 1s

This commit is contained in:
shortcutme 2017-08-18 14:45:48 +02:00
parent 32a0f96ecd
commit b6c0c955c5
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -85,6 +85,10 @@ class FileRequestPlugin(object):
back["onion_sign_this"] = "%.0f" % time.time() # Send back nonce for signing
for hash in hashes:
if time.time() - time_started > 1: # 1 sec limit on request
self.connection.log("Announce time limit exceeded after %s/%s sites" % (len(peers), len(hashes)))
break
hash_peers = db.peerList(
hash,
ip4=self.connection.ip, onions=params.get("onions"), port=params["port"],