Implemented DNS on blockchain. Beautified a lot of code, fixed some things.

This commit is contained in:
Revertron
2021-02-19 16:41:43 +01:00
parent 4b5e5112da
commit d135204af7
24 changed files with 539 additions and 295 deletions
+2 -3
View File
@@ -13,7 +13,6 @@ use mio::net::{TcpListener, TcpStream};
use crate::{Context, Block, p2p::Message, p2p::State, p2p::Peer, p2p::Peers};
use std::net::{SocketAddr, IpAddr, SocketAddrV4, Shutdown};
use std::ops::DerefMut;
const SERVER: Token = Token(0);
const POLL_TIMEOUT: Option<Duration> = Some(Duration::from_millis(3000));
@@ -95,8 +94,8 @@ impl Network {
None => {}
Some(mut peer) => {
let stream = peer.get_stream();
poll.registry().deregister(stream);
stream.shutdown(Shutdown::Both);
let _ = poll.registry().deregister(stream);
let _ = stream.shutdown(Shutdown::Both);
println!("Peer connection {:?} has shut down", &peer.get_addr());
}
}