Do the easy check first

All functions above operate on immutable values, so this shouldn't
change functionality, but no repair_window() tests to be certain.hI
This commit is contained in:
Greg Fitzgerald
2018-09-07 11:23:27 -06:00
parent 09ba0dae15
commit d77699c126

View File

@ -122,6 +122,10 @@ fn repair_window(
consumed: u64,
received: u64,
) -> Option<Vec<(SocketAddr, Vec<u8>)>> {
if received <= consumed {
return None;
}
//exponential backoff
if !repair_backoff(last, times, consumed) {
trace!("{} !repair_backoff() times = {}", id, times);
@ -134,10 +138,6 @@ fn repair_window(
received,
);
if received <= consumed {
return None;
}
let mut window = window.write().unwrap();
let idxs = clear_window_slots(&mut window, recycler, consumed, highest_lost);
let reqs: Vec<_> = idxs