From 61c52f15a3a2b81d718993668ba1a0a31e980ad2 Mon Sep 17 00:00:00 2001 From: arkpar Date: Sun, 14 Feb 2016 17:42:03 +0100 Subject: [PATCH] Fixed panic on accessing expired node --- util/src/network/host.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/util/src/network/host.rs b/util/src/network/host.rs index 89cc4c225..454e8e802 100644 --- a/util/src/network/host.rs +++ b/util/src/network/host.rs @@ -82,7 +82,7 @@ impl NetworkConfiguration { pin: false, boot_nodes: Vec::new(), use_secret: None, - ideal_peers: 10, + ideal_peers: 25, } } @@ -467,9 +467,10 @@ impl Host where Message: Send + Sync + Clone { let socket = { let address = { let mut nodes = self.nodes.write().unwrap(); - let node = nodes.get_mut(id).unwrap(); - node.last_attempted = Some(::time::now()); - node.endpoint.address + if let Some(node) = nodes.get_mut(id) { + node.last_attempted = Some(::time::now()); + node.endpoint.address + } }; match TcpStream::connect(&address) { Ok(socket) => socket,