Fixed ping processing.

Changed the limit of active connections from 10 to 15.
pull/99/head v0.4.26
Revertron 3 years ago
parent 1b406baeca
commit 640e2a0619

@ -1,6 +1,6 @@
[package]
name = "alfis"
version = "0.4.25"
version = "0.4.26"
authors = ["Revertron <alfis@revertron.com>"]
edition = "2018"
build = "build.rs"

@ -44,4 +44,4 @@ pub const LOG_REFRESH_DELAY_SEC: u64 = 60;
pub const POLL_TIMEOUT: Option<Duration> = Some(Duration::from_millis(250));
pub const MAX_PACKET_SIZE: usize = 1 * 1024 * 1024; // 1 Mb
pub const MAX_READ_BLOCK_TIME: u128 = 500;
pub const MAX_NODES: usize = 10;
pub const MAX_NODES: usize = 15;

@ -441,8 +441,9 @@ fn handle_message(context: Arc<Mutex<Context>>, message: Message, peers: &mut Pe
if peer.is_higher(my_height) {
let mut context = context.lock().unwrap();
context.chain.update_max_height(height);
}
if my_height == height && hash.ne(&my_hash) {
info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip());
State::message(Message::GetBlock { index: height })
} else if my_height == height && hash.ne(&my_hash) {
info!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip());
info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash);
State::message(Message::GetBlock { index: my_height })
@ -458,8 +459,9 @@ fn handle_message(context: Arc<Mutex<Context>>, message: Message, peers: &mut Pe
if peer.is_higher(my_height) {
let mut context = context.lock().unwrap();
context.chain.update_max_height(height);
}
if my_height == height && hash.ne(&my_hash) {
info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip());
State::message(Message::GetBlock { index: height })
} else if my_height == height && hash.ne(&my_hash) {
info!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip());
info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash);
State::message(Message::GetBlock { index: my_height })

Loading…
Cancel
Save