def __init__(self, port, id_, version): self._id = id_ self._version = version self._server = KRPCServer(port, self._version) self._rt = PrefixRoutingTable() # Thread details self._shutdown_flag = False self._thread = None # default handler self.handler = self.default_handler # Behaviour configuration # Am I actively seeking out other nodes? self.active_discovery = True # After how many seconds should i do another self-lookup? self.self_find_delay = 180.0 # How many active node discovery attempts between self-lookups? self.active_discoveries = 10 # Session key self._key = os.urandom(20) # 20 random bytes == 160 bits