Beispiel #1
0
 def _patched_sender(self):
     ksender = KRPC_Sender(TreeRoutingTable, 2**50)
     ksender.transport = HollowTransport()
     # Start the protocol to simulate
     # a regular environment
     rate_limited_proto = RateLimiter_Patcher(ksender)
     rate_limited_proto.startProtocol()
     return rate_limited_proto
Beispiel #2
0
 def _patched_sender(self):
     ksender = KRPC_Sender(TreeRoutingTable, 2**50)
     ksender.transport = HollowTransport()
     # Start the protocol to simulate
     # a regular environment
     rate_limited_proto = RateLimiter_Patcher(ksender)
     rate_limited_proto.startProtocol()
     return rate_limited_proto
Beispiel #3
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()
Beispiel #4
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()