From cf9d8cf7c2cf220f80846b2c2fb7ef8adcd36cb9 Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 3 Jul 2023 12:20:39 -0400 Subject: [PATCH] fix punish --- veilid-core/src/network_manager/connection_manager.rs | 3 ++- veilid-core/src/network_manager/connection_table.rs | 4 ++-- .../src/network_manager/tests/test_connection_table.rs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/veilid-core/src/network_manager/connection_manager.rs b/veilid-core/src/network_manager/connection_manager.rs index 1496aae0..cf6744ef 100644 --- a/veilid-core/src/network_manager/connection_manager.rs +++ b/veilid-core/src/network_manager/connection_manager.rs @@ -63,12 +63,13 @@ impl ConnectionManager { c.network.connection_inactivity_timeout_ms, ) }; + let address_filter = network_manager.address_filter(); ConnectionManagerArc { network_manager, connection_initial_timeout_ms, connection_inactivity_timeout_ms, - connection_table: ConnectionTable::new(config), + connection_table: ConnectionTable::new(config, address_filter), address_lock_table: AsyncTagLockTable::new(), inner: Mutex::new(None), } diff --git a/veilid-core/src/network_manager/connection_table.rs b/veilid-core/src/network_manager/connection_table.rs index 6ca9b210..3e8f11e8 100644 --- a/veilid-core/src/network_manager/connection_table.rs +++ b/veilid-core/src/network_manager/connection_table.rs @@ -38,7 +38,7 @@ pub struct ConnectionTable { } impl ConnectionTable { - pub fn new(config: VeilidConfig) -> Self { + pub fn new(config: VeilidConfig, address_filter: AddressFilter) -> Self { let max_connections = { let c = config.get(); vec![ @@ -58,7 +58,7 @@ impl ConnectionTable { protocol_index_by_id: BTreeMap::new(), id_by_descriptor: BTreeMap::new(), ids_by_remote: BTreeMap::new(), - address_filter: AddressFilter::new(config), + address_filter, })), } } diff --git a/veilid-core/src/network_manager/tests/test_connection_table.rs b/veilid-core/src/network_manager/tests/test_connection_table.rs index 8a48c79d..5a52cd46 100644 --- a/veilid-core/src/network_manager/tests/test_connection_table.rs +++ b/veilid-core/src/network_manager/tests/test_connection_table.rs @@ -5,8 +5,8 @@ use crate::tests::common::test_veilid_config::*; pub async fn test_add_get_remove() { let config = get_config(); - - let table = ConnectionTable::new(config); + let address_filter = AddressFilter::new(config.clone()); + let table = ConnectionTable::new(config, address_filter); let a1 = ConnectionDescriptor::new_no_local(PeerAddress::new( SocketAddress::new(Address::IPV4(Ipv4Addr::new(192, 168, 0, 1)), 8080),