more punish fixes

This commit is contained in:
John Smith 2023-07-03 16:42:49 -04:00
parent ffc54f482e
commit 6de2ccb1f9
3 changed files with 16 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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());
// 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;
});