diff --git a/veilid-core/src/network_manager/mod.rs b/veilid-core/src/network_manager/mod.rs index 504b27fc..b45e96c6 100644 --- a/veilid-core/src/network_manager/mod.rs +++ b/veilid-core/src/network_manager/mod.rs @@ -760,6 +760,9 @@ impl NetworkManager { Some(nr) => nr, }; + // Remove any 'last connection' to this peer to ensure we start a new connection with the reverse connection + peer_nr.clear_last_connection(); + // Make a reverse connection to the peer and send the receipt to it rpc.rpc_call_return_receipt(Destination::Direct(peer_nr), None, receipt) .await @@ -783,6 +786,9 @@ impl NetworkManager { Some(nr) => nr, }; + // Remove any 'last connection' to this peer to ensure we start a new connection with the hole punch + peer_nr.clear_last_connection(); + // Get the udp direct dialinfo for the hole punch let outbound_dif = self .get_outbound_dial_info_filter(RoutingDomain::PublicInternet) diff --git a/veilid-core/src/routing_table/node_ref.rs b/veilid-core/src/routing_table/node_ref.rs index 31935706..55bce1ef 100644 --- a/veilid-core/src/routing_table/node_ref.rs +++ b/veilid-core/src/routing_table/node_ref.rs @@ -263,6 +263,10 @@ impl NodeRef { Some(last_connection) } + pub fn clear_last_connection(&self) { + self.operate_mut(|e| e.clear_last_connection()) + } + pub fn has_any_dial_info(&self) -> bool { self.operate(|e| { e.node_info()