From b18772465cd15c21c40dc51b64d14d1f1023d365 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Thu, 17 Sep 2020 16:19:48 +0100 Subject: [PATCH] limit the number of hosts read from each pong --- .../main/groovy/com/muwire/core/connection/Connection.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 957205bb..d5a63130 100644 --- a/core/src/main/groovy/com/muwire/core/connection/Connection.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/Connection.groovy @@ -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.each { + pong.pongs.stream().limit(10).forEach { def dest = new Destination(it) eventBus.publish(new HostDiscoveredEvent(destination: dest)) }