Fixed banning process.
This commit is contained in:
@@ -635,9 +635,7 @@ impl Chain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_max_height(&mut self, height: u64) {
|
pub fn update_max_height(&mut self, height: u64) {
|
||||||
if height > self.max_height {
|
self.max_height = height;
|
||||||
self.max_height = height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if this block can be added to our blockchain
|
/// Check if this block can be added to our blockchain
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ impl Network {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if peers.is_ignored(&address.ip()) {
|
||||||
|
debug!("Ignoring connection from banned {:?}", &address.ip());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if yggdrasil_only && !is_yggdrasil(&address.ip()) {
|
if yggdrasil_only && !is_yggdrasil(&address.ip()) {
|
||||||
debug!("Dropping connection from Internet");
|
debug!("Dropping connection from Internet");
|
||||||
stream.shutdown(Shutdown::Both).unwrap_or_else(|e|{ warn!("Error in shutdown, {}", e); });
|
stream.shutdown(Shutdown::Both).unwrap_or_else(|e|{ warn!("Error in shutdown, {}", e); });
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ impl Peers {
|
|||||||
self.my_id.eq(rand)
|
self.my_id.eq(rand)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_ignored(&self, addr: &IpAddr) -> bool {
|
||||||
|
self.ignored.contains(addr)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_peers_for_exchange(&self, peer_address: &SocketAddr) -> Vec<String> {
|
pub fn get_peers_for_exchange(&self, peer_address: &SocketAddr) -> Vec<String> {
|
||||||
let mut result: Vec<String> = Vec::new();
|
let mut result: Vec<String> = Vec::new();
|
||||||
for (_, peer) in self.peers.iter() {
|
for (_, peer) in self.peers.iter() {
|
||||||
|
|||||||
Reference in New Issue
Block a user