fix punish

This commit is contained in:
John Smith 2023-07-03 12:20:39 -04:00
parent b7e531f35b
commit cf9d8cf7c2
3 changed files with 6 additions and 5 deletions

View File

@ -63,12 +63,13 @@ impl ConnectionManager {
c.network.connection_inactivity_timeout_ms, c.network.connection_inactivity_timeout_ms,
) )
}; };
let address_filter = network_manager.address_filter();
ConnectionManagerArc { ConnectionManagerArc {
network_manager, network_manager,
connection_initial_timeout_ms, connection_initial_timeout_ms,
connection_inactivity_timeout_ms, connection_inactivity_timeout_ms,
connection_table: ConnectionTable::new(config), connection_table: ConnectionTable::new(config, address_filter),
address_lock_table: AsyncTagLockTable::new(), address_lock_table: AsyncTagLockTable::new(),
inner: Mutex::new(None), inner: Mutex::new(None),
} }

View File

@ -38,7 +38,7 @@ pub struct ConnectionTable {
} }
impl ConnectionTable { impl ConnectionTable {
pub fn new(config: VeilidConfig) -> Self { pub fn new(config: VeilidConfig, address_filter: AddressFilter) -> Self {
let max_connections = { let max_connections = {
let c = config.get(); let c = config.get();
vec![ vec![
@ -58,7 +58,7 @@ impl ConnectionTable {
protocol_index_by_id: BTreeMap::new(), protocol_index_by_id: BTreeMap::new(),
id_by_descriptor: BTreeMap::new(), id_by_descriptor: BTreeMap::new(),
ids_by_remote: BTreeMap::new(), ids_by_remote: BTreeMap::new(),
address_filter: AddressFilter::new(config), address_filter,
})), })),
} }
} }

View File

@ -5,8 +5,8 @@ use crate::tests::common::test_veilid_config::*;
pub async fn test_add_get_remove() { pub async fn test_add_get_remove() {
let config = get_config(); let config = get_config();
let address_filter = AddressFilter::new(config.clone());
let table = ConnectionTable::new(config); let table = ConnectionTable::new(config, address_filter);
let a1 = ConnectionDescriptor::new_no_local(PeerAddress::new( let a1 = ConnectionDescriptor::new_no_local(PeerAddress::new(
SocketAddress::new(Address::IPV4(Ipv4Addr::new(192, 168, 0, 1)), 8080), SocketAddress::new(Address::IPV4(Ipv4Addr::new(192, 168, 0, 1)), 8080),