Ver código fonte

remove origin_node_id

Alex Cheema 5 meses atrás
pai
commit
db7c388ac6
2 arquivos alterados com 4 adições e 6 exclusões
  1. 1 1
      exo/orchestration/standard_node.py
  2. 3 5
      exo/topology/topology.py

+ 1 - 1
exo/orchestration/standard_node.py

@@ -410,7 +410,7 @@ class StandardNode(Node):
       try:
         other_topology = await asyncio.wait_for(peer.collect_topology(visited, max_depth=max_depth - 1), timeout=5.0)
         if DEBUG >= 2: print(f"Collected topology from: {peer.id()}: {other_topology}")
-        next_topology.merge(self.id, other_topology)
+        next_topology.merge(other_topology)
       except Exception as e:
         print(f"Error collecting topology from {peer.id()}: {e}")
         traceback.print_exc()

+ 3 - 5
exo/topology/topology.py

@@ -39,14 +39,12 @@ class Topology:
     conn = PeerConnection(from_id, to_id, description)
     self.peer_graph[from_id].add(conn)
 
-  def merge(self, origin_node_id: str, other: "Topology"):
+  def merge(self, other: "Topology"):
     for node_id, capabilities in other.nodes.items():
-      if node_id != origin_node_id:
-        self.update_node(node_id, capabilities)
+      self.update_node(node_id, capabilities)
     for node_id, connections in other.peer_graph.items():
       for conn in connections:
-        if conn.from_id != origin_node_id:
-          self.add_edge(conn.from_id, conn.to_id, conn.description)
+        self.add_edge(conn.from_id, conn.to_id, conn.description)
 
   def __str__(self):
     nodes_str = ", ".join(f"{node_id}: {cap}" for node_id, cap in self.nodes.items())