proper status setting
This commit is contained in:
parent
a20600c9d1
commit
c3d0ed6e69
@ -292,7 +292,7 @@ impl ChainSync {
|
|||||||
trace!(target: "sync", "Ignored unexpected block headers");
|
trace!(target: "sync", "Ignored unexpected block headers");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if io.chain().queue_info().full {
|
if self.state == SyncState::Waiting {
|
||||||
trace!(target: "sync", "Ignored block headers while waiting");
|
trace!(target: "sync", "Ignored block headers while waiting");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ impl ChainSync {
|
|||||||
trace!(target: "sync", "Ignored unexpected block bodies");
|
trace!(target: "sync", "Ignored unexpected block bodies");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if io.chain().queue_info().full {
|
if self.state == SyncState::Waiting {
|
||||||
trace!(target: "sync", "Ignored block bodies while waiting");
|
trace!(target: "sync", "Ignored block bodies while waiting");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@ -987,6 +987,11 @@ impl ChainSync {
|
|||||||
/// Handle peer timeouts
|
/// Handle peer timeouts
|
||||||
pub fn maintain_peers(&self, io: &mut SyncIo) {
|
pub fn maintain_peers(&self, io: &mut SyncIo) {
|
||||||
let tick = time::precise_time_s();
|
let tick = time::precise_time_s();
|
||||||
|
|
||||||
|
if !io.chain().queue_info().full {
|
||||||
|
self.state == SyncState::Idle;
|
||||||
|
}
|
||||||
|
|
||||||
for (peer_id, peer) in &self.peers {
|
for (peer_id, peer) in &self.peers {
|
||||||
if peer.asking != PeerAsking::Nothing && (tick - peer.ask_time) > CONNECTION_TIMEOUT_SEC {
|
if peer.asking != PeerAsking::Nothing && (tick - peer.ask_time) > CONNECTION_TIMEOUT_SEC {
|
||||||
io.disconnect_peer(*peer_id);
|
io.disconnect_peer(*peer_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user