Better handling of RPC errors and RPC conn with the PeerManager (#1047)

This commit is contained in:
divma
2020-05-03 08:17:12 -05:00
committed by GitHub
parent b6c027b9ec
commit b4a1a2e483
16 changed files with 656 additions and 463 deletions

View File

@@ -98,7 +98,7 @@ impl std::fmt::Display for Client {
// helper function to identify clients from their agent_version. Returns the client
// kind and it's associated version and the OS kind.
fn client_from_agent_version(agent_version: &str) -> (ClientKind, String, String) {
let mut agent_split = agent_version.split("/");
let mut agent_split = agent_version.split('/');
match agent_split.next() {
Some("Lighthouse") => {
let kind = ClientKind::Lighthouse;
@@ -116,7 +116,7 @@ fn client_from_agent_version(agent_version: &str) -> (ClientKind, String, String
let kind = ClientKind::Teku;
let mut version = String::from("unknown");
let mut os_version = version.clone();
if let Some(_) = agent_split.next() {
if agent_split.next().is_some() {
if let Some(agent_version) = agent_split.next() {
version = agent_version.into();
if let Some(agent_os_version) = agent_split.next() {