From d77699c126d44202075c376277fc0024ce3ae74a Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Fri, 7 Sep 2018 11:23:27 -0600 Subject: [PATCH] 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 --- src/window.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/window.rs b/src/window.rs index 47ea1c94d3..f2154bc5a5 100644 --- a/src/window.rs +++ b/src/window.rs @@ -122,6 +122,10 @@ fn repair_window( consumed: u64, received: u64, ) -> Option)>> { + 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