more logging on update requests, only add peer to already peer locked tasks, no traceback on peer send error, only allow 1 sec timeout when publishing, request 50 peers from tracker, peer limited startworkers, sitePublish to 20 peers

This commit is contained in:
HelloZeroNet 2015-01-15 23:24:51 +01:00
parent bcd0c0025a
commit aae1022c79
6 changed files with 33 additions and 21 deletions

View file

@ -152,12 +152,12 @@ class Site:
# Update content.json on peers
def publish(self, limit=3):
self.log.info( "Publishing to %s/%s peers..." % (len(self.peers), limit) )
self.log.info( "Publishing to %s/%s peers..." % (limit, len(self.peers)) )
published = 0
for key, peer in self.peers.items(): # Send update command to each peer
result = {"exception": "Timeout"}
try:
with gevent.Timeout(2, False): # 2 sec timeout
with gevent.Timeout(1, False): # 1 sec timeout
result = peer.sendCmd("update", {
"site": self.address,
"inner_path": "content.json",
@ -229,7 +229,7 @@ class Site:
try:
tracker.connect()
tracker.poll_once()
tracker.announce(info_hash=hashlib.sha1(self.address).hexdigest())
tracker.announce(info_hash=hashlib.sha1(self.address).hexdigest(), num_want=50)
back = tracker.poll_once()
except Exception, err:
self.log.error("Tracker error: %s" % err)