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
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()
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()