Formatting
This commit is contained in:
parent
38057c2e03
commit
23389dc31e
1 changed files with 9 additions and 9 deletions
|
@ -10,7 +10,6 @@ import struct
|
|||
import socket
|
||||
import urllib
|
||||
import urllib2
|
||||
import cStringIO as StringIO
|
||||
|
||||
import gevent
|
||||
|
||||
|
@ -424,10 +423,10 @@ class Site(object):
|
|||
# Add more, non-connected peers
|
||||
peers_more = self.peers.values()
|
||||
random.shuffle(peers_more)
|
||||
peers += peers_more[0:limit*2]
|
||||
peers += peers_more[0:limit * 2]
|
||||
|
||||
self.log.info("Publishing %s to %s/%s peers (connected: %s) diffs: %s (%.2fk)..." % (
|
||||
inner_path, limit, len(self.peers), num_connected_peers, diffs.keys(), float(len(str(diffs)))/1024
|
||||
inner_path, limit, len(self.peers), num_connected_peers, diffs.keys(), float(len(str(diffs))) / 1024
|
||||
))
|
||||
|
||||
if not peers:
|
||||
|
@ -446,12 +445,12 @@ class Site(object):
|
|||
|
||||
# Publish more peers in the backgroup
|
||||
self.log.info(
|
||||
"Successfuly %s published to %s peers, publishing to %s more peers in the background" % (
|
||||
inner_path, len(published), limit
|
||||
))
|
||||
"Successfuly %s published to %s peers, publishing to %s more peers in the background" %
|
||||
(inner_path, len(published), limit)
|
||||
)
|
||||
|
||||
for thread in range(2):
|
||||
gevent.spawn(self.publisher, inner_path, peers, published, limit=limit*2)
|
||||
gevent.spawn(self.publisher, inner_path, peers, published, limit=limit * 2)
|
||||
|
||||
# Send my hashfield to every connected peer if changed
|
||||
gevent.spawn(self.sendMyHashfield, 100)
|
||||
|
@ -505,7 +504,8 @@ class Site(object):
|
|||
# If -default in path, create a -default less copy of the file
|
||||
if "-default" in file_inner_path:
|
||||
file_path_dest = new_site.storage.getPath(file_inner_path.replace("-default", ""))
|
||||
if new_site.storage.isFile(file_inner_path.replace("-default", "")) and not overwrite: # Don't overwrite site files with default ones
|
||||
if new_site.storage.isFile(file_inner_path.replace("-default", "")) and not overwrite:
|
||||
# Don't overwrite site files with default ones
|
||||
self.log.debug("[SKIP] Default file: %s (already exist)" % file_inner_path)
|
||||
continue
|
||||
self.log.debug("[COPY] Default file: %s to %s..." % (file_inner_path, file_path_dest))
|
||||
|
@ -833,7 +833,7 @@ class Site(object):
|
|||
if time.time() - peer.time_found > 60 * 60 * 4: # Not found on tracker or via pex in last 4 hour
|
||||
peer.remove()
|
||||
removed += 1
|
||||
if removed > len(peers)*0.1: # Don't remove too much at once
|
||||
if removed > len(peers) * 0.1: # Don't remove too much at once
|
||||
break
|
||||
|
||||
if removed:
|
||||
|
|
Loading…
Reference in a new issue