Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
one more try to fix the connection problem
orbiterd87d295c6853
diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.javaindex 879edbd69..2fa84e22d 100644--- a/source/de/anomic/http/httpc.java+++ b/source/de/anomic/http/httpc.java@@ -396,11 +396,14 @@ public final class httpc {this.initTime = System.currentTimeMillis();this.lastIO = System.currentTimeMillis();this.socket.setKeepAlive(false);- // setting socket timeout and keep alive behaviour+ // set socket timeout and keep alive behavior+ assert timeout >= 1000;this.socket.setSoTimeout(timeout); // waiting time for read+ this.socket.setTcpNoDelay(true); // no accumulation until buffer is full+ this.socket.setSoLinger(true, timeout); // wait for all data being written on close()+// get the connectionthis.socket.connect(address, timeout);- this.socket.setSoTimeout(timeout); // waiting time for readif (incomingByteCountAccounting != null) {this.clientInputByteCount = new httpdByteCountInputStream(this.socket.getInputStream(),incomingByteCountAccounting);diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.javaindex 956d13c35..bfdefa1aa 100644--- a/source/de/anomic/server/serverCore.java+++ b/source/de/anomic/server/serverCore.java@@ -410,7 +410,17 @@ public final class serverCore extends serverAbstractThread implements serverThreif ((this.denyHost == null) || (this.denyHost.get(cIP) == null)) {// setting the timeout properly+ assert this.timeout >= 1000;controlSocket.setSoTimeout(this.timeout);+ // keep-alive: if set to true, the server frequently sends keep-alive packets to the client which the client must respond to+ // we set this to false to prevent that a missing ack from the client forces the server to close the connection+ controlSocket.setKeepAlive(false);++ // disable Nagle's algorithm (waiting for more data until packet is full)+ controlSocket.setTcpNoDelay(true);++ // set a non-zero linger, that means that a socket.close() blocks until all data is written+ controlSocket.setSoLinger(true, this.timeout);// create sessionSession connection = new Session(sessionThreadGroup, controlSocket, this.timeout);