Fixed ping processing.
Changed the limit of active connections from 10 to 15.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "alfis"
|
name = "alfis"
|
||||||
version = "0.4.25"
|
version = "0.4.26"
|
||||||
authors = ["Revertron <alfis@revertron.com>"]
|
authors = ["Revertron <alfis@revertron.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
build = "build.rs"
|
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 POLL_TIMEOUT: Option<Duration> = Some(Duration::from_millis(250));
|
||||||
pub const MAX_PACKET_SIZE: usize = 1 * 1024 * 1024; // 1 Mb
|
pub const MAX_PACKET_SIZE: usize = 1 * 1024 * 1024; // 1 Mb
|
||||||
pub const MAX_READ_BLOCK_TIME: u128 = 500;
|
pub const MAX_READ_BLOCK_TIME: u128 = 500;
|
||||||
pub const MAX_NODES: usize = 10;
|
pub const MAX_NODES: usize = 15;
|
||||||
|
|||||||
+6
-4
@@ -441,8 +441,9 @@ fn handle_message(context: Arc<Mutex<Context>>, message: Message, peers: &mut Pe
|
|||||||
if peer.is_higher(my_height) {
|
if peer.is_higher(my_height) {
|
||||||
let mut context = context.lock().unwrap();
|
let mut context = context.lock().unwrap();
|
||||||
context.chain.update_max_height(height);
|
context.chain.update_max_height(height);
|
||||||
}
|
info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip());
|
||||||
if my_height == height && hash.ne(&my_hash) {
|
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!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip());
|
||||||
info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash);
|
info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash);
|
||||||
State::message(Message::GetBlock { index: my_height })
|
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) {
|
if peer.is_higher(my_height) {
|
||||||
let mut context = context.lock().unwrap();
|
let mut context = context.lock().unwrap();
|
||||||
context.chain.update_max_height(height);
|
context.chain.update_max_height(height);
|
||||||
}
|
info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip());
|
||||||
if my_height == height && hash.ne(&my_hash) {
|
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!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip());
|
||||||
info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash);
|
info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash);
|
||||||
State::message(Message::GetBlock { index: my_height })
|
State::message(Message::GetBlock { index: my_height })
|
||||||
|
|||||||
Reference in New Issue
Block a user