From 43e48dd144d08c6629b449cfeb2a2f6736d8a8cb Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 16 May 2021 19:00:06 +0100 Subject: [PATCH] introduce a multiplicative factor to the probability of forwarding a query --- .../muwire/core/connection/UltrapeerConnectionManager.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy index d3cc9e26..9e2b62a8 100644 --- a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy @@ -16,6 +16,8 @@ import net.i2p.data.Destination @Log class UltrapeerConnectionManager extends ConnectionManager { + + private static final int QUERY_FACTOR = 2 final int maxPeers, maxLeafs final TrustService trustService @@ -52,7 +54,7 @@ class UltrapeerConnectionManager extends ConnectionManager { final int connCount = peerConnections.size() if (connCount == 0) return - final int treshold = (int)(Math.sqrt(connCount)) + 1 + final int treshold = QUERY_FACTOR * ((int)(Math.sqrt(connCount)) + 1) peerConnections.values().each { // 1. do not send query back to originator // 2. if firstHop forward to everyone