Beispiel #1
0
    def __init__(self, routing_table_class=TreeRoutingTable,
        node_id=None, _reactor=None):

        if node_id is None:
            node_id = random.getrandbits(constants.id_size)

        # Verify the node_id is valid
        basic_coder.encode_network_id(node_id)
        KRPC_Sender.__init__(self, routing_table_class, node_id, _reactor)

        # Datastore is used for storing peers on torrents
        self._datastore = defaultdict(set)
        self._token_generator = _TokenGenerator()