sync test temp fix

This commit is contained in:
Nikolay Volf 2016-02-04 03:44:40 +03:00
parent 99a63d0639
commit ce7b5b03ad
2 changed files with 6 additions and 4 deletions

View File

@ -79,6 +79,8 @@ struct Verification {
bad: HashSet<H256>,
}
const MAX_UNVERIFIED_QUEUE_SIZE: usize = 50000;
impl BlockQueue {
/// Creates a new queue instance.
pub fn new(engine: Arc<Box<Engine>>, message_channel: IoChannel<NetSyncMessage>) -> BlockQueue {
@ -290,7 +292,7 @@ impl BlockQueue {
pub fn queue_info(&self) -> BlockQueueInfo {
let verification = self.verification.lock().unwrap();
BlockQueueInfo {
full: false,
full: verification.unverified.len() + verification.verifying.len() >= MAX_UNVERIFIED_QUEUE_SIZE,
verified_queue_size: verification.verified.len(),
unverified_queue_size: verification.unverified.len(),
verifying_queue_size: verification.verifying.len(),

View File

@ -292,7 +292,7 @@ impl ChainSync {
trace!(target: "sync", "Ignored unexpected block headers");
return Ok(());
}
if self.state == SyncState::Waiting {
if io.chain().queue_info().full {
trace!(target: "sync", "Ignored block headers while waiting");
return Ok(());
}
@ -376,7 +376,7 @@ impl ChainSync {
trace!(target: "sync", "Ignored unexpected block bodies");
return Ok(());
}
if self.state == SyncState::Waiting {
if io.chain().queue_info().full {
trace!(target: "sync", "Ignored block bodies while waiting");
return Ok(());
}
@ -532,7 +532,7 @@ impl ChainSync {
/// Enter waiting state
fn pause_sync(&mut self) {
trace!(target: "sync", "Block queue full, pausing sync");
self.state = SyncState::Waiting;
//self.state = SyncState::Waiting;
}
/// Find something to do for a peer. Called for a new peer or when a peer is done with it's task.