From f81e42b7bc5bc40cdecb520b85eb31508a53c42e Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Wed, 17 Jul 2024 19:11:49 +0800 Subject: [PATCH] Early return process_fetch_cmd if ckb received exit signal --- sync/src/synchronizer/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sync/src/synchronizer/mod.rs b/sync/src/synchronizer/mod.rs index 18c34204be..8313f313ee 100644 --- a/sync/src/synchronizer/mod.rs +++ b/sync/src/synchronizer/mod.rs @@ -89,10 +89,17 @@ impl BlockFetchCMD { match self.can_start() { CanStart::Ready => { for peer in peers { + if ckb_stop_handler::has_received_stop_signal() { + return; + } + if let Some(fetch) = BlockFetcher::new(Arc::clone(&self.sync_shared), peer, ibd_state).fetch() { for item in fetch { + if ckb_stop_handler::has_received_stop_signal() { + return; + } BlockFetchCMD::send_getblocks(item, &self.p2p_control, peer); } }