Make sure downloaded blocks are unmarked on send error

This commit is contained in:
arkpar 2016-05-27 16:35:52 +02:00
parent 468d761e5c
commit f85e409ff7

View File

@ -862,16 +862,12 @@ impl ChainSync {
warn!(target:"sync", "Asking {:?} while requesting {:?}", peer.asking, asking); warn!(target:"sync", "Asking {:?} while requesting {:?}", peer.asking, asking);
} }
} }
match sync.send(peer_id, packet_id, packet) { let mut peer = self.peers.get_mut(&peer_id).unwrap();
Err(e) => { peer.asking = asking;
debug!(target:"sync", "Error sending request: {:?}", e); peer.ask_time = time::precise_time_s();
sync.disable_peer(peer_id); if let Err(e) = sync.send(peer_id, packet_id, packet) {
} debug!(target:"sync", "Error sending request: {:?}", e);
Ok(_) => { sync.disable_peer(peer_id);
let mut peer = self.peers.get_mut(&peer_id).unwrap();
peer.asking = asking;
peer.ask_time = time::precise_time_s();
}
} }
} }