diff --git a/core/src/main/groovy/com/muwire/core/connection/ConnectionEstablisher.groovy b/core/src/main/groovy/com/muwire/core/connection/ConnectionEstablisher.groovy index 1b0fac1c..d48cf891 100644 --- a/core/src/main/groovy/com/muwire/core/connection/ConnectionEstablisher.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/ConnectionEstablisher.groovy @@ -56,7 +56,7 @@ class ConnectionEstablisher { if (inProgress.size() >= CONCURRENT) return - def toTry + def toTry = null for (int i = 0; i < 5; i++) { toTry = hostCache.getHosts(1) if (toTry.isEmpty()) @@ -67,7 +67,8 @@ class ConnectionEstablisher { break } } - + if (toTry == null) + return inProgress.add(toTry) executor.execute({connect(toTry)} as Runnable) }