Beispiel #1
0
 def __getattr__(self, key):
     self.site.log.debug("PeerHashfield %s" % (self.key))
     if key == "hashfield":
         self.hashfield = PeerHashfield()
         return self.hashfield
     else:
         return getattr(self, key)
Beispiel #2
0
 def __getattr__(self, key):
     if key == "hashfield":
         self.has_hashfield = True
         self.hashfield = PeerHashfield()
         return self.hashfield
     else:
         return getattr(self, key)
Beispiel #3
0
    def __init__(self, ip, port, site=None):
        self.ip = ip
        self.port = port
        self.site = site
        self.key = "%s:%s" % (ip, port)

        self.connection = None
        self.hashfield = PeerHashfield()  # Got optional files hash_id
        self.time_hashfield = None  # Last time peer's hashfiled downloaded
        self.time_my_hashfield_sent = None  # Last time my hashfield sent to peer
        self.time_found = time.time()  # Time of last found in the torrent tracker
        self.time_response = None  # Time of last successful response from peer
        self.time_added = time.time()
        self.last_ping = None  # Last response time for ping

        self.connection_error = 0  # Series of connection error
        self.hash_failed = 0  # Number of bad files from peer
        self.download_bytes = 0  # Bytes downloaded
        self.download_time = 0  # Time spent to download