From 167374969d571d24c4ccd2048ad9744515a5c63a Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Fri, 14 Jul 2023 17:13:58 -0400 Subject: [PATCH] connections work --- veilid-core/src/network_manager/send_data.rs | 6 +++++- veilid-core/src/routing_table/bucket_entry.rs | 7 +++++++ veilid-core/src/routing_table/node_ref.rs | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/veilid-core/src/network_manager/send_data.rs b/veilid-core/src/network_manager/send_data.rs index 59ae1c7e..6a3f5720 100644 --- a/veilid-core/src/network_manager/send_data.rs +++ b/veilid-core/src/network_manager/send_data.rs @@ -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 diff --git a/veilid-core/src/routing_table/bucket_entry.rs b/veilid-core/src/routing_table/bucket_entry.rs index 39f7e9f4..e400875d 100644 --- a/veilid-core/src/routing_table/bucket_entry.rs +++ b/veilid-core/src/routing_table/bucket_entry.rs @@ -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(); diff --git a/veilid-core/src/routing_table/node_ref.rs b/veilid-core/src/routing_table/node_ref.rs index a10dfecf..6580e171 100644 --- a/veilid-core/src/routing_table/node_ref.rs +++ b/veilid-core/src/routing_table/node_ref.rs @@ -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() {