mirror of https://github.com/EdgeVPNio/evio.git
Keep existing incoming links
parent
c58721ba7d
commit
0bd5f0c416
|
@ -150,7 +150,6 @@ class GraphBuilder:
|
|||
adj_list: ConnEdgeAdjacenctList,
|
||||
transition_adj_list: ConnEdgeAdjacenctList,
|
||||
):
|
||||
# Preserve existing incoming ldl
|
||||
ldlnks = {}
|
||||
if 2 * self._min_successors > len(self._peers):
|
||||
return # not enough peers to build LDL
|
||||
|
@ -261,6 +260,21 @@ class GraphBuilder:
|
|||
)
|
||||
self._build_static(adj_list)
|
||||
if not self._manual_topo:
|
||||
# Preserve existing incoming links
|
||||
inlnks = transition_adj_list.select_incoming_edges()
|
||||
for ce in inlnks.values():
|
||||
if (
|
||||
ce.edge_state
|
||||
in (
|
||||
EDGE_STATES.Initialized,
|
||||
EDGE_STATES.PreAuth,
|
||||
EDGE_STATES.Authorized,
|
||||
EDGE_STATES.Created,
|
||||
EDGE_STATES.Connected,
|
||||
)
|
||||
and ce.peer_id not in adj_list
|
||||
):
|
||||
adj_list[ce.peer_id] = ce
|
||||
self._build_successors(adj_list, transition_adj_list)
|
||||
self._build_long_dist_links(adj_list, transition_adj_list)
|
||||
self._build_ondemand_links(adj_list, transition_adj_list, request_list)
|
||||
|
|
|
@ -333,6 +333,10 @@ class ConnEdgeAdjacenctList(MutableMapping):
|
|||
def update_edge(self, new_conn_edge: ConnectionEdge):
|
||||
ce = self._conn_edges.get(new_conn_edge.peer_id)
|
||||
if ce:
|
||||
if ce.role != CONNECTION_ROLE.Initiator:
|
||||
raise ValueError(
|
||||
"Existing ConnectionEdge's role is not an initiator, ce=%s", ce
|
||||
)
|
||||
self._decr_edge_type_count(ce.edge_type)
|
||||
ce.edge_type = new_conn_edge.edge_type
|
||||
self._incr_edge_type_count(ce.edge_type)
|
||||
|
@ -362,6 +366,15 @@ class ConnEdgeAdjacenctList(MutableMapping):
|
|||
matches = state_match
|
||||
return matches
|
||||
|
||||
def select_incoming_edges(
|
||||
self,
|
||||
) -> dict[str, ConnectionEdge]:
|
||||
matches = {}
|
||||
for peer_id, ce in self._conn_edges.items():
|
||||
if ce.edge_type in EDGE_TYPE_IN:
|
||||
matches[peer_id] = ce
|
||||
return matches
|
||||
|
||||
def clear_tincan_ces(self):
|
||||
rml = []
|
||||
for peer_id, ce in self._conn_edges.items():
|
||||
|
|
Loading…
Reference in New Issue