Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

close unused connections if there to many for DHT

sixcoolerc2098f9399b7
diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.java
index 2202e5ced..9c704452f 100644
--- a/source/de/anomic/search/Switchboard.java
+++ b/source/de/anomic/search/Switchboard.java
@@ -2005,6 +2005,8 @@ public final class Switchboard extends serverSwitch {
log.logInfo("dhtTransferJob: no selection, too less memory available : " + (MemoryControl.available() / 1024 / 1024) + " MB");
} else if (Client.connectionCount() > 25) {
log.logInfo("dhtTransferJob: too many connections in httpc pool : " + Client.connectionCount());
+ // close unused connections
+ Client.cleanup();
} else {
byte[] startHash = null, limitHash = null;
int tries = 10;
@@ -2035,6 +2037,8 @@ public final class Switchboard extends serverSwitch {
log.logInfo("dhtTransferJob: no dequeueing from cloud to transmission: too many concurrent sessions: " + this.dhtDispatcher.transmissionSize());
} else if (Client.connectionCount() > 25) {
log.logInfo("dhtTransferJob: too many connections in httpc pool : " + Client.connectionCount());
+ // close unused connections
+ Client.cleanup();
} else {
boolean dequeued = this.dhtDispatcher.dequeueContainer();
hasDoneSomething = hasDoneSomething | dequeued;