diff --git a/Cargo.toml b/Cargo.toml index f40ed92..5d16de7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alfis" -version = "0.3.11" +version = "0.3.12" authors = ["Revertron "] edition = "2018" build = "build.rs" diff --git a/alfis.toml b/alfis.toml index d30393b..a9df9ae 100644 --- a/alfis.toml +++ b/alfis.toml @@ -28,6 +28,7 @@ forwarders = ["94.140.14.14:53", "94.140.15.15:53"] #forwarders = ["1.1.1.1:53", "1.0.0.1:53"] # Hosts file support (resolve local names or block ads) #hosts = ["system", "adblock.txt"] +hosts = ["adblock.txt", "wyrd.txt"] #Mining options [mining] diff --git a/src/p2p/network.rs b/src/p2p/network.rs index 17d5501..06d28ff 100644 --- a/src/p2p/network.rs +++ b/src/p2p/network.rs @@ -23,7 +23,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; const SERVER: Token = Token(0); const POLL_TIMEOUT: Option = Some(Duration::from_millis(3000)); pub const LISTEN_PORT: u16 = 4244; -const MAX_PACKET_SIZE: usize = 10 * 1024 * 1024; // 10 Mb +const MAX_PACKET_SIZE: usize = 1 * 1024 * 1024; // 1 Mb const MAX_READ_BLOCK_TIME: u128 = 500; pub struct Network { @@ -301,6 +301,9 @@ fn read_message(stream: &mut TcpStream) -> Result, ()> { match stream.read(&mut buf[bytes_read..]) { Ok(bytes) => { bytes_read += bytes; + if bytes_read == data_size { + break; + } } // Would block "errors" are the OS's way of saying that the connection is not actually ready to perform this I/O operation. Err(ref err) if would_block(err) => { @@ -314,7 +317,7 @@ fn read_message(stream: &mut TcpStream) -> Result, ()> { Err(ref err) if interrupted(err) => continue, // Other errors we'll consider fatal. Err(_) => { - debug!("Error reading message, only {} bytes read", bytes_read); + debug!("Error reading message, only {}/{} bytes read", bytes_read, data_size); return Err(()) }, }