mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
debug
This commit is contained in:
@ -96,12 +96,13 @@ where
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let addr = SocketAddr::new(info.remote_addr.ip(), hlfs_port);
|
let addr = SocketAddr::new(info.remote_addr.ip(), hlfs_port);
|
||||||
if let max_block = probe_hlfs(addr).await {
|
let max_block = probe_hlfs(addr).await;
|
||||||
|
if max_block != 0 {
|
||||||
let mut g = good.lock().await;
|
let mut g = good.lock().await;
|
||||||
if g.insert(PeerRecord { addr, max_block }) {
|
if g.insert(PeerRecord { addr, max_block }) {
|
||||||
let v: Vec<_> = g.iter().copied().collect();
|
let v: Vec<_> = g.iter().copied().collect();
|
||||||
backfiller.set_peers(v.clone());
|
backfiller.set_peers(v.clone());
|
||||||
info!(%addr, total=v.len(), "hlfs: peer added");
|
info!(%addr, %max_block, total=v.len(), "hlfs: peer added");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug!(%addr, "hlfs: peer has no HLFS");
|
debug!(%addr, "hlfs: peer has no HLFS");
|
||||||
@ -117,7 +118,7 @@ where
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn probe_hlfs(addr: SocketAddr) -> u64 {
|
pub(crate) async fn probe_hlfs(addr: SocketAddr) -> u64 {
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{AsyncReadExt, AsyncWriteExt},
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
net::TcpStream,
|
net::TcpStream,
|
||||||
|
|||||||
@ -91,6 +91,7 @@ impl Client {
|
|||||||
pub fn new(root: impl Into<PathBuf>, peers: Vec<PeerRecord>) -> Self {
|
pub fn new(root: impl Into<PathBuf>, peers: Vec<PeerRecord>) -> Self {
|
||||||
let root: PathBuf = root.into();
|
let root: PathBuf = root.into();
|
||||||
let n = find_max_number_file(&root).unwrap();
|
let n = find_max_number_file(&root).unwrap();
|
||||||
|
debug!(max_block = n, "hlfs: our archive");
|
||||||
Self {
|
Self {
|
||||||
root,
|
root,
|
||||||
peers: Arc::new(Mutex::new(peers)),
|
peers: Arc::new(Mutex::new(peers)),
|
||||||
|
|||||||
Reference in New Issue
Block a user