pub struct RoutingNode {
pub id: Id20,
pub addr: SocketAddr,
pub last_seen: Instant,
pub fail_count: u32,
pub last_response: Option<Instant>,
pub last_query: Option<Instant>,
}Expand description
A node in the routing table.
Fields§
§id: Id20Node’s 20-byte Kademlia ID.
addr: SocketAddrNode’s socket address.
last_seen: InstantTimestamp of the last successful interaction.
fail_count: u32Number of consecutive failed queries.
last_response: Option<Instant>Timestamp of the last response received from this node.
last_query: Option<Instant>Timestamp of the last query received from this node.
Implementations§
Source§impl RoutingNode
impl RoutingNode
Sourcepub fn status(&self) -> NodeStatus
pub fn status(&self) -> NodeStatus
Classify this node per Kademlia liveness rules.
Bad:fail_count>= 2Good: responded or sent a query within the last 15 minutesQuestionable: otherwise
M175 BUG FIX: previously computed Instant::now() - ACTIVE_THRESHOLD,
which panics during the first 15 min of process uptime (Instant
monotonic clock not yet at the threshold). Reformulated to compare
elapsed time forward via Instant::duration_since, which saturates at
zero on clock skew. M132-class avoidance — same bug shape as the
fetch_sub(1) underflow that shipped in M132.
Trait Implementations§
Source§impl Clone for RoutingNode
impl Clone for RoutingNode
Source§fn clone(&self) -> RoutingNode
fn clone(&self) -> RoutingNode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RoutingNode
impl RefUnwindSafe for RoutingNode
impl Send for RoutingNode
impl Sync for RoutingNode
impl Unpin for RoutingNode
impl UnsafeUnpin for RoutingNode
impl UnwindSafe for RoutingNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more