From b4a47e663c865bae6bece641f845d69410d6a325 Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Mon, 13 Aug 2018 10:07:19 -0700 Subject: [PATCH] Cap repair requests timeout --- src/window.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/window.rs b/src/window.rs index fbf5f0d837400e..0cc51e0d01fcb2 100644 --- a/src/window.rs +++ b/src/window.rs @@ -108,6 +108,14 @@ fn repair_window( } *last = consumed; *times += 1; + + // Experiment with capping repair request duration. + // Once nodes are too far behind they can spend many + // seconds without asking for repair + if *times > 128 { + *times = 65; + } + //if times flips from all 1s 7 -> 8, 15 -> 16, we retry otherwise return Ok if *times & (*times - 1) != 0 { trace!("repair_window counter {} {} {}", *times, consumed, received);