From e5891de136e74dedbd961006f8102b0d93887f7f Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 20 Sep 2020 18:26:29 +0100 Subject: [PATCH] send and read up to 2 hosts per pong --- .../main/groovy/com/muwire/core/connection/Connection.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/connection/Connection.groovy b/core/src/main/groovy/com/muwire/core/connection/Connection.groovy index d5a63130..fa1b2ea5 100644 --- a/core/src/main/groovy/com/muwire/core/connection/Connection.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/Connection.groovy @@ -168,7 +168,7 @@ abstract class Connection implements Closeable { pong.version = 1 if (ping.uuid != null) pong.uuid = ping.uuid - pong.pongs = hostCache.getGoodHosts(10).collect { d -> d.toBase64() } + pong.pongs = hostCache.getGoodHosts(2).collect { d -> d.toBase64() } messages.put(pong) } @@ -177,7 +177,7 @@ abstract class Connection implements Closeable { lastPongReceivedTime = System.currentTimeMillis() if (pong.pongs == null) throw new Exception("Pong doesn't have pongs") - pong.pongs.stream().limit(10).forEach { + pong.pongs.stream().limit(2).forEach { def dest = new Destination(it) eventBus.publish(new HostDiscoveredEvent(destination: dest)) }