From 568a308c823f63a1359da22bafb21f000bb23b83 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 18 Aug 2022 19:27:18 -0400 Subject: [PATCH] testing --- veilid-core/src/network_manager/tasks.rs | 3 ++- .../network_manager/tests/test_connection_table.rs | 14 +++++++------- veilid-server/src/settings.rs | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/veilid-core/src/network_manager/tasks.rs b/veilid-core/src/network_manager/tasks.rs index 8ad0d0e1..0b8748c5 100644 --- a/veilid-core/src/network_manager/tasks.rs +++ b/veilid-core/src/network_manager/tasks.rs @@ -345,9 +345,10 @@ impl NetworkManager { // This is so we can preserve the inbound NAT mappings at our router for did in &dids { // Do we need to do this ping? + // Check if we have already pinged over this low-level-protocol/address-type/port combo + // We want to ensure we do the bare minimum required here let pt = did.dial_info.protocol_type(); let at = did.dial_info.address_type(); - let needs_ping = if let Some((llpt, port)) = mapped_port_info.protocol_to_port.get(&(pt, at)) { 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 0618af12..6b9c5953 100644 --- a/veilid-core/src/network_manager/tests/test_connection_table.rs +++ b/veilid-core/src/network_manager/tests/test_connection_table.rs @@ -10,18 +10,18 @@ pub async fn test_add_get_remove() { let mut table = ConnectionTable::new(config); let a1 = ConnectionDescriptor::new_no_local(PeerAddress::new( - SocketAddress::new(Address::IPV4(Ipv4Addr::new(127, 0, 0, 1)), 8080), + SocketAddress::new(Address::IPV4(Ipv4Addr::new(192, 168, 0, 1)), 8080), ProtocolType::TCP, )) .unwrap(); let a2 = a1; let a3 = ConnectionDescriptor::new( PeerAddress::new( - SocketAddress::new(Address::IPV6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8090), + SocketAddress::new(Address::IPV6(Ipv6Addr::new(191, 0, 0, 0, 0, 0, 0, 1)), 8090), ProtocolType::TCP, ), SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new( - Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), + Ipv6Addr::new(191, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0, @@ -30,11 +30,11 @@ pub async fn test_add_get_remove() { .unwrap(); let a4 = ConnectionDescriptor::new( PeerAddress::new( - SocketAddress::new(Address::IPV6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8090), + SocketAddress::new(Address::IPV6(Ipv6Addr::new(192, 0, 0, 0, 0, 0, 0, 1)), 8090), ProtocolType::TCP, ), SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new( - Ipv6Addr::new(1, 0, 0, 0, 0, 0, 0, 1), + Ipv6Addr::new(192, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0, @@ -43,11 +43,11 @@ pub async fn test_add_get_remove() { .unwrap(); let a5 = ConnectionDescriptor::new( PeerAddress::new( - SocketAddress::new(Address::IPV6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 8090), + SocketAddress::new(Address::IPV6(Ipv6Addr::new(192, 0, 0, 0, 0, 0, 0, 1)), 8090), ProtocolType::WSS, ), SocketAddress::from_socket_addr(SocketAddr::V6(SocketAddrV6::new( - Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), + Ipv6Addr::new(193, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0, diff --git a/veilid-server/src/settings.rs b/veilid-server/src/settings.rs index e62242e4..f1bb3147 100644 --- a/veilid-server/src/settings.rs +++ b/veilid-server/src/settings.rs @@ -93,7 +93,7 @@ core: set_value_timeout: set_value_count: 20 set_value_fanout: 5 - min_peer_count: 2 # 20 + min_peer_count: 20 min_peer_refresh_time_ms: 2000 validate_dial_info_receipt_time_ms: 2000 upnp: false @@ -1457,10 +1457,10 @@ mod tests { assert_eq!(s.core.network.connection_initial_timeout_ms, 2_000u32); assert_eq!(s.core.network.connection_inactivity_timeout_ms, 60_000u32); - assert_eq!(s.core.network.max_connections_per_ip4, 8u32); - assert_eq!(s.core.network.max_connections_per_ip6_prefix, 8u32); + assert_eq!(s.core.network.max_connections_per_ip4, 32u32); + assert_eq!(s.core.network.max_connections_per_ip6_prefix, 32u32); assert_eq!(s.core.network.max_connections_per_ip6_prefix_size, 56u32); - assert_eq!(s.core.network.max_connection_frequency_per_min, 8u32); + assert_eq!(s.core.network.max_connection_frequency_per_min, 128u32); assert_eq!(s.core.network.client_whitelist_timeout_ms, 300_000u32); assert_eq!(s.core.network.reverse_connection_receipt_time_ms, 5_000u32); assert_eq!(s.core.network.hole_punch_receipt_time_ms, 5_000u32);