Fixed panic on accessing expired node
This commit is contained in:
parent
fc7483ab87
commit
61c52f15a3
@ -82,7 +82,7 @@ impl NetworkConfiguration {
|
|||||||
pin: false,
|
pin: false,
|
||||||
boot_nodes: Vec::new(),
|
boot_nodes: Vec::new(),
|
||||||
use_secret: None,
|
use_secret: None,
|
||||||
ideal_peers: 10,
|
ideal_peers: 25,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,9 +467,10 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
|
|||||||
let socket = {
|
let socket = {
|
||||||
let address = {
|
let address = {
|
||||||
let mut nodes = self.nodes.write().unwrap();
|
let mut nodes = self.nodes.write().unwrap();
|
||||||
let node = nodes.get_mut(id).unwrap();
|
if let Some(node) = nodes.get_mut(id) {
|
||||||
node.last_attempted = Some(::time::now());
|
node.last_attempted = Some(::time::now());
|
||||||
node.endpoint.address
|
node.endpoint.address
|
||||||
|
}
|
||||||
};
|
};
|
||||||
match TcpStream::connect(&address) {
|
match TcpStream::connect(&address) {
|
||||||
Ok(socket) => socket,
|
Ok(socket) => socket,
|
||||||
|
Loading…
Reference in New Issue
Block a user