diff --git a/veilid-core/src/network_manager/address_filter.rs b/veilid-core/src/network_manager/address_filter.rs index 9818c671..326a41b0 100644 --- a/veilid-core/src/network_manager/address_filter.rs +++ b/veilid-core/src/network_manager/address_filter.rs @@ -115,6 +115,7 @@ impl AddressFilter { } } for key in dead_keys { + log_net!(debug ">>> FORGIVING: {}", key); inner.punishments_by_ip4.remove(&key); } } @@ -130,6 +131,7 @@ impl AddressFilter { } } for key in dead_keys { + log_net!(debug ">>> FORGIVING: {}", key); inner.punishments_by_ip6_prefix.remove(&key); } } diff --git a/veilid-core/src/network_manager/native/network_tcp.rs b/veilid-core/src/network_manager/native/network_tcp.rs index 925ebb31..3c9434bf 100644 --- a/veilid-core/src/network_manager/native/network_tcp.rs +++ b/veilid-core/src/network_manager/native/network_tcp.rs @@ -118,8 +118,8 @@ impl Network { return; } }; - let address_filter = self.network_manager().address_filter(); // Check to see if it is punished + let address_filter = self.network_manager().address_filter(); if address_filter.is_punished(peer_addr.ip()) { return; } diff --git a/veilid-core/src/network_manager/network_connection.rs b/veilid-core/src/network_manager/network_connection.rs index 4f532838..f657037b 100644 --- a/veilid-core/src/network_manager/network_connection.rs +++ b/veilid-core/src/network_manager/network_connection.rs @@ -240,6 +240,7 @@ impl NetworkConnection { ); let network_manager = connection_manager.network_manager(); + let address_filter = network_manager.address_filter(); let mut unord = FuturesUnordered::new(); let mut need_receiver = true; let mut need_sender = true; @@ -301,11 +302,20 @@ impl NetworkConnection { .then(|res| async { match res { Ok(v) => { - if v.is_no_connection() { - let peer_address = protocol_connection.descriptor().remote(); - log_net!(debug "Connection closed from: {} ({})", peer_address.socket_address().to_socket_addr(), peer_address.protocol_type()); + let peer_address = protocol_connection.descriptor().remote(); + + // Check to see if it is punished + if address_filter.is_punished(peer_address.to_socket_addr().ip()) { return RecvLoopAction::Finish; } + + // Check for connection close + if v.is_no_connection() { + log_net!(debug "Connection closed from: {} ({})", peer_address.to_socket_addr(), peer_address.protocol_type()); + return RecvLoopAction::Finish; + } + + // Log other network results let mut message = network_result_value_or_log!(v => [ format!(": protocol_connection={:?}", protocol_connection) ] { return RecvLoopAction::Finish; });