From a3155ff7d0366bbf38ced5c9303c617f268bc450 Mon Sep 17 00:00:00 2001
From: Michael Eischer <eischer@cs.fau.de>
Date: Mon, 29 Aug 2022 18:23:02 +0200
Subject: [PATCH] network: Only create message delay timer if FAKE_WAN_DELAYS
 are active

Otherwise using multiple replica threads will result in an Exception.
---
 src/refit/communication/REFITNetworkEndpointWorker.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/refit/communication/REFITNetworkEndpointWorker.java b/src/refit/communication/REFITNetworkEndpointWorker.java
index 787e848..e69475c 100644
--- a/src/refit/communication/REFITNetworkEndpointWorker.java
+++ b/src/refit/communication/REFITNetworkEndpointWorker.java
@@ -60,7 +60,9 @@ public class REFITNetworkEndpointWorker extends REFITSchedulerTask {
 		if (address.nodeID != nodeID) {
 			throw new IllegalArgumentException("Got connection for wrong node!");
 		}
-		timer = newTimer(this::timeout);
+		if (REFITConfig.FAKE_WAN_DELAYS) {
+			timer = newTimer(this::timeout);
+		}
 		this.address = address;
 		try {
 			connection.init(socketChannel);
-- 
GitLab