clear last connection

This commit is contained in:
John Smith 2022-08-06 10:23:26 -04:00
parent 0e047a0120
commit e7ae6b04bd
2 changed files with 10 additions and 0 deletions

View File

@ -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)

View File

@ -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()