From 74373aebcfdfcf5c03e4fb6510d8dd664a0b9b88 Mon Sep 17 00:00:00 2001 From: Trinity Pointard Date: Tue, 6 Apr 2021 05:25:28 +0200 Subject: make most requested changes --- src/rpc/membership.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/rpc/membership.rs') diff --git a/src/rpc/membership.rs b/src/rpc/membership.rs index c465ce68..4fce1a7b 100644 --- a/src/rpc/membership.rs +++ b/src/rpc/membership.rs @@ -1,4 +1,4 @@ -/// Module containing structs related to membership management +//! Module containing structs related to membership management use std::collections::HashMap; use std::fmt::Write as FmtWrite; use std::io::{Read, Write}; @@ -96,7 +96,7 @@ pub struct System { rpc_client: Arc>, pub(crate) status: watch::Receiver>, - /// The ring, viewed by this node + /// The ring pub ring: watch::Receiver>, update_lock: Mutex, @@ -114,9 +114,8 @@ struct Updaters { #[derive(Debug, Clone)] pub struct Status { /// Mapping of each node id to its known status - // considering its sorted regularly, maybe it should be a btreeset? pub nodes: HashMap>, - /// Hash of this entry + /// Hash of `nodes`, used to detect when nodes have different views of the cluster pub hash: Hash, } @@ -380,7 +379,7 @@ impl System { id_option, addr, sys.rpc_client - .get_addr() + .by_addr() .call(&addr, ping_msg_ref, PING_TIMEOUT) .await, ) @@ -418,6 +417,8 @@ impl System { } } else if let Some(id) = id_option { if let Some(st) = status.nodes.get_mut(id) { + // TODO this might double-increment the value as the counter is already + // incremented for any kind of failure in rpc_client st.num_failures.fetch_add(1, Ordering::SeqCst); if !st.is_up() { warn!("Node {:?} seems to be down.", id); -- cgit v1.2.3