예제 #1
0
    def __init__(self, routing_table_class=TreeRoutingTable, node_id=None):
        node_id = node_id if node_id is not None else random.getrandbits(160)
        # Verify the node_id is valid
        basic_coder.encode_network_id(node_id)
        KRPC_Sender.__init__(self, routing_table_class, node_id)

        # Datastore is used for storing peers on torrents
        self._datastore = MemoryDataStore(self._reactor)
        self._token_generator = _TokenGenerator()
예제 #2
0
    def __init__(self, routing_table_class=TreeRoutingTable, node_id=None):
        node_id = (node_id if node_id is not None
                           else random.getrandbits(160))
        # Verify the node_id is valid
        basic_coder.encode_network_id(node_id)
        KRPC_Sender.__init__(self, routing_table_class, node_id)

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