Add last_seen to peer info (#1688)

* add last_seen to peer and update on ping/pong
expose last_seen in tui

* rustfmt

* chrono serde features
This commit is contained in:
Antioch Peverell
2018-10-08 13:39:52 +01:00
committed by GitHub
parent fd2eda2308
commit de5b6868fb
6 changed files with 25 additions and 27 deletions
+5
View File
@@ -19,6 +19,8 @@ use std::sync::atomic::AtomicBool;
use std::sync::{Arc, RwLock};
use std::time::SystemTime;
use chrono::prelude::*;
use chain;
use common::types::SyncStatus;
use p2p;
@@ -144,6 +146,8 @@ pub struct PeerStats {
pub height: u64,
/// direction
pub direction: String,
/// Last time we saw a ping/pong from this peer.
pub last_seen: DateTime<Utc>,
}
impl StratumStats {
@@ -176,6 +180,7 @@ impl PeerStats {
total_difficulty: peer.info.total_difficulty.to_num(),
height: peer.info.height,
direction: direction.to_string(),
last_seen: peer.info.last_seen,
}
}
}