From 32b032204a48bb04319718f2ccd20a74e3f1bf83 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 25 Jan 2021 15:16:04 +1000 Subject: [PATCH] Consistently return Response::Nil during setup And log an info-level message as a diagnostic, in case setup takes a long time. --- zebrad/src/components/inbound.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zebrad/src/components/inbound.rs b/zebrad/src/components/inbound.rs index e40f4c73..3aacc187 100644 --- a/zebrad/src/components/inbound.rs +++ b/zebrad/src/components/inbound.rs @@ -179,7 +179,10 @@ impl Service for Inbound { peers.truncate(MAX_ADDR); async { Ok(zn::Response::Peers(peers)) }.boxed() } - None => async { Err("not ready to serve addresses".into()) }.boxed(), + None => { + info!("ignoring `Peers` request from remote peer during network setup"); + async { Ok(zn::Response::Nil) }.boxed() + } }, zn::Request::BlocksByHash(hashes) => { // Correctness: @@ -245,6 +248,11 @@ impl Service for Inbound { zn::Request::AdvertiseBlock(hash) => { if let Some(downloads) = self.downloads.as_mut() { downloads.download_and_verify(hash); + } else { + info!( + ?hash, + "ignoring `AdvertiseBlock` request from remote peer during network setup" + ); } async { Ok(zn::Response::Nil) }.boxed() }