From 29a348eb8a14bc607947e15a1c8a3233f0d7bf48 Mon Sep 17 00:00:00 2001 From: choelzl Date: Tue, 10 Nov 2020 17:19:45 +0100 Subject: [PATCH] Fix infinite loop --- 257844/src/main/java/cs451/net/handler/NetHandlerFD.java | 4 ++-- 257844/src/main/java/cs451/tools/ParamDetector.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/257844/src/main/java/cs451/net/handler/NetHandlerFD.java b/257844/src/main/java/cs451/net/handler/NetHandlerFD.java index a253de4..a168673 100644 --- a/257844/src/main/java/cs451/net/handler/NetHandlerFD.java +++ b/257844/src/main/java/cs451/net/handler/NetHandlerFD.java @@ -29,12 +29,12 @@ public class NetHandlerFD extends NetEventHandlerAbstract { @Override public void beat() { hosts.forEach(h-> alive.computeIfPresent(h.getId(),(k, v) -> { - if(v == -1) return 1; + if(v == -1) return 0; if(v > NetManager.FD_MAX_TRIES) crashNextAsync(NetEvent.Message(h, Message.EMPTY())); else sendNextSync(NetEvent.MessageHRTB(h)); - return v; + return v+1; })); } diff --git a/257844/src/main/java/cs451/tools/ParamDetector.java b/257844/src/main/java/cs451/tools/ParamDetector.java index d0e2e9a..fa42eae 100644 --- a/257844/src/main/java/cs451/tools/ParamDetector.java +++ b/257844/src/main/java/cs451/tools/ParamDetector.java @@ -37,11 +37,13 @@ public abstract class ParamDetector { System.out.println("Starting Process with WindowWidth of "+windowWidth+" (~ x"+windowWidthMult+")."); NetManager.WINDOW_WIDTH = windowWidth; + NetManager.INTERNAL_WAIT = 500; + //We might want to PingPong To set Custom Timing Limitations.... - NetManager.FD_MAX_TRIES = 3; + NetManager.FD_MAX_TRIES = 10; NetManager.FD_WAIT = 1000; NetManager.SL_MAX_TRIES = 8; - NetManager.INTERNAL_WAIT = 500; + NetManager.SL_WAIT = NetManager.INTERNAL_WAIT; } }