From 9c6f6bf2663184200f02b46a8c192509bec11ef2 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 16 Sep 2020 12:30:41 +0100 Subject: [PATCH] Make number of connections for ultrapeer a property --- core/src/main/groovy/com/muwire/core/Core.groovy | 2 +- .../main/groovy/com/muwire/core/MuWireSettings.groovy | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/main/groovy/com/muwire/core/Core.groovy b/core/src/main/groovy/com/muwire/core/Core.groovy index 258f1fcb..34fe28e4 100644 --- a/core/src/main/groovy/com/muwire/core/Core.groovy +++ b/core/src/main/groovy/com/muwire/core/Core.groovy @@ -309,7 +309,7 @@ public class Core { log.info("initializing connection manager") connectionManager = props.isLeaf() ? new LeafConnectionManager(eventBus, me, 3, hostCache, props) : - new UltrapeerConnectionManager(eventBus, me, 512, 512, hostCache, trustService, props) + new UltrapeerConnectionManager(eventBus, me, props.peerConnections, props.leafConnections, hostCache, trustService, props) eventBus.register(TrustEvent.class, connectionManager) eventBus.register(ConnectionEvent.class, connectionManager) eventBus.register(DisconnectionEvent.class, connectionManager) diff --git a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy index 1bf82c32..88019f6a 100644 --- a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy +++ b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy @@ -41,6 +41,8 @@ class MuWireSettings { int defaultFeedItemsToKeep boolean defaultFeedSequential + int peerConnections + int leafConnections boolean startChatServer int maxChatConnections @@ -104,6 +106,10 @@ class MuWireSettings { defaultFeedSequential = Boolean.valueOf(props.getProperty("defaultFeedSequential", "false")) defaultFeedUpdateInterval = Integer.valueOf(props.getProperty("defaultFeedUpdateInterval", "60000")) + // ultrapeer connection settings + leafConnections = Integer.valueOf(props.getProperty("leafConnections","512")) + peerConnections = Integer.valueOf(props.getProperty("peerConnections","512")) + speedSmoothSeconds = Integer.valueOf(props.getProperty("speedSmoothSeconds","10")) totalUploadSlots = Integer.valueOf(props.getProperty("totalUploadSlots","-1")) uploadSlotsPerUser = Integer.valueOf(props.getProperty("uploadSlotsPerUser","-1")) @@ -170,6 +176,10 @@ class MuWireSettings { props.setProperty("defaultFeedSequential", String.valueOf(defaultFeedSequential)) props.setProperty("defaultFeedUpdateInterval", String.valueOf(defaultFeedUpdateInterval)) + // ultrapeer connection settings + props.setProperty("peerConnections", String.valueOf(peerConnections)) + props.setProperty("leafConnections", String.valueOf(leafConnections)) + props.setProperty("speedSmoothSeconds", String.valueOf(speedSmoothSeconds)) props.setProperty("totalUploadSlots", String.valueOf(totalUploadSlots)) props.setProperty("uploadSlotsPerUser", String.valueOf(uploadSlotsPerUser))