connections work

This commit is contained in:
Christien Rioux 2023-07-14 17:13:58 -04:00
parent 6c2aaa16c6
commit 167374969d
3 changed files with 18 additions and 1 deletions

View File

@ -276,7 +276,11 @@ impl NetworkManager {
connection_descriptor,
)));
}
Some(d) => d,
Some(d) => {
// Connection couldn't send, kill it
node_ref.clear_last_connection(connection_descriptor);
d
}
}
} else {
data

View File

@ -411,6 +411,13 @@ impl BucketEntryInner {
.insert(key, (last_connection, timestamp));
}
// Removes a connection descriptor in this entry's table of last connections
pub fn clear_last_connection(&mut self, last_connection: ConnectionDescriptor) {
let key = self.descriptor_to_key(last_connection);
self.last_connections
.remove(&key);
}
// Clears the table of last connections to ensure we create new ones and drop any existing ones
pub fn clear_last_connections(&mut self) {
self.last_connections.clear();

View File

@ -308,6 +308,12 @@ pub trait NodeRefBase: Sized {
})
}
fn clear_last_connection(&self, connection_descriptor: ConnectionDescriptor) {
self.operate_mut(|rti, e| {
e.clear_last_connection(connection_descriptor);
})
}
fn has_any_dial_info(&self) -> bool {
self.operate(|_rti, e| {
for rtd in RoutingDomain::all() {