Пример #1
0
 def _setup_dht(
         self
 ):  # does not block startup, the dht will re-attempt if necessary
     self.dht_node = self.dht_node_class(
         node_id=self.node_id,
         udpPort=self.dht_node_port,
         externalIP=self.external_ip,
         peerPort=self.peer_port,
         peer_manager=self.peer_manager,
         peer_finder=self.peer_finder,
     )
     if not self.hash_announcer:
         self.hash_announcer = hashannouncer.DHTHashAnnouncer(
             self.dht_node, self.storage)
     self.peer_manager = self.dht_node.peer_manager
     self.peer_finder = self.dht_node.peer_finder
     d = self.dht_node.start(self.known_dht_nodes)
     d.addCallback(lambda _: log.info("Joined the dht"))
     d.addCallback(lambda _: self.hash_announcer.start())
Пример #2
0
 def start(self):
     storage = self.component_manager.get_component(DATABASE_COMPONENT)
     dht_node = self.component_manager.get_component(DHT_COMPONENT)
     self.hash_announcer = hashannouncer.DHTHashAnnouncer(dht_node, storage)
     yield self.hash_announcer.start()