diff --git a/parity/informant.rs b/parity/informant.rs index a9f7d3636..56bb3ad4d 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -90,6 +90,7 @@ pub struct SyncInfo { last_imported_old_block_number: Option, num_peers: usize, max_peers: u32, + snapshot_sync: bool, } pub struct Report { @@ -152,6 +153,7 @@ impl InformantData for FullNodeInformantData { last_imported_old_block_number: status.last_imported_old_block_number, num_peers: status.num_peers, max_peers: status.current_max_peers(net_config.min_peers, net_config.max_peers), + snapshot_sync: status.is_snapshot_syncing(), })) } _ => (is_major_importing(self.sync.as_ref().map(|s| s.status().state), queue_info.clone()), None), @@ -196,6 +198,7 @@ impl InformantData for LightNodeInformantData { last_imported_old_block_number: None, num_peers: peer_numbers.connected, max_peers: peer_numbers.max as u32, + snapshot_sync: false, }); Report { @@ -282,7 +285,7 @@ impl Informant { _ => (false, 0, 0), } ); - + let snapshot_sync = snapshot_sync && sync_info.as_ref().map_or(false, |s| s.snapshot_sync); if !importing && !snapshot_sync && elapsed < Duration::from_secs(30) { return; } diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 42781fdc5..05e979bbd 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -695,7 +695,7 @@ impl ChainSync { } } else { trace!(target: "sync", "{}: Fork mismatch", peer_id); - io.disconnect_peer(peer_id); + io.disable_peer(peer_id); return Ok(()); } } @@ -1153,7 +1153,7 @@ impl ChainSync { trace!(target: "sync", "== Connected {}: {}", peer, io.peer_info(peer)); if let Err(e) = self.send_status(io, peer) { debug!(target:"sync", "Error sending status request: {:?}", e); - io.disable_peer(peer); + io.disconnect_peer(peer); } else { self.handshaking_peers.insert(peer, time::precise_time_ns()); } @@ -1454,7 +1454,7 @@ impl ChainSync { }; if let Err(e) = result { debug!(target:"sync", "Error sending request: {:?}", e); - sync.disable_peer(peer_id); + sync.disconnect_peer(peer_id); } } } @@ -1463,7 +1463,7 @@ impl ChainSync { fn send_packet(&mut self, sync: &mut SyncIo, peer_id: PeerId, packet_id: PacketId, packet: Bytes) { if let Err(e) = sync.send(peer_id, packet_id, packet) { debug!(target:"sync", "Error sending packet: {:?}", e); - sync.disable_peer(peer_id); + sync.disconnect_peer(peer_id); } }