Example #1
0
 def configure(self, conf):
     StreamHandler.configure(self, conf)
     self.numpieces = conf["bittorrent.numpieces"]
     self.bitfield = make_bitfield(self.numpieces)
     self.peer_bitfield = make_bitfield(self.numpieces)
     self.my_id = conf["bittorrent.my_id"]
     self.target_bytes = conf["bittorrent.bytes.down"]
     self.make_sched()
Example #2
0
 def connect(self, endpoint, count=1):
     self.connector_side = True
     #
     # In Neubot the listener does not have an infohash
     # and handshakes, including connector infohash, after
     # it receives the connector handshake.
     #
     self.infohash = self.conf["bittorrent.infohash"]
     LOG.start("BitTorrent: connecting to %s" % str(endpoint))
     StreamHandler.connect(self, endpoint, count)
Example #3
0
 def __init__(self, poller):
     StreamHandler.__init__(self, poller)
     STATE.update("test", "bittorrent")
     self.connector_side = False
     self.saved_bytes = 0
     self.saved_ticks = 0
     self.inflight = 0
     self.dload_speed = 0
     self.repeat = MAX_REPEAT
     self.state = INITIAL
     self.infohash = None
     self.rtt = 0
     self.version = 1
     self.begin_upload = 0.0
Example #4
0
 def __init__(self, poller):
     StreamHandler.__init__(self, poller)
     STATE.update("test_latency", "---", publish=False)
     STATE.update("test_download", "---", publish=False)
     STATE.update("test_upload", "---", publish=False)
     STATE.update("test", "bittorrent")
     self.connector_side = False
     self.saved_bytes = 0
     self.saved_ticks = 0
     self.inflight = 0
     self.dload_speed = 0
     self.repeat = MAX_REPEAT
     self.state = INITIAL
     self.infohash = None
     self.rtt = 0
Example #5
0
 def __init__(self, poller):
     ''' Initialize the HTTP client '''
     StreamHandler.__init__(self, poller)
     self.host_header = ""
     self.rtt = 0
Example #6
0
 def __init__(self, poller):
     ''' Initialize the HTTP server '''
     StreamHandler.__init__(self, poller)
     self._ssl_ports = set()
     self.childs = {}
Example #7
0
 def __init__(self, poller):
     StreamHandler.__init__(self, poller)
     self._ssl_ports = set()
     self.childs = {}
Example #8
0
 def __init__(self, poller):
     StreamHandler.__init__(self, poller)
     self.host_header = ""
     self.rtt = 0