Author: orbiter
Date: 2008-03-12 14:13:11 +0100 (Wed, 12 Mar 2008)
New Revision: 4556
Modified:
trunk/source/de/anomic/http/httpc.java
trunk/source/de/anomic/server/serverCore.java
Log:
one more try to fix the connection problem
Modified: trunk/source/de/anomic/http/httpc.java
===================================================================
--- trunk/source/de/anomic/http/httpc.java 2008-03-12 00:56:18 UTC (rev
4555)
+++ trunk/source/de/anomic/http/httpc.java 2008-03-12 13:13:11 UTC (rev
4556)
@@ -396,11 +396,14 @@
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 connection
this.socket.connect(address, timeout);
- this.socket.setSoTimeout(timeout); // waiting time for read
if (incomingByteCountAccounting != null) {
this.clientInputByteCount = new
httpdByteCountInputStream(this.socket.getInputStream(),incomingByteCountAccounting);
Modified: trunk/source/de/anomic/server/serverCore.java
===================================================================
--- trunk/source/de/anomic/server/serverCore.java 2008-03-12 00:56:18 UTC
(rev 4555)
+++ trunk/source/de/anomic/server/serverCore.java 2008-03-12 13:13:11 UTC
(rev 4556)
@@ -410,8 +410,18 @@
if ((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 session
Session connection = new Session(sessionThreadGroup,
controlSocket, this.timeout);
this.busySessions.add(connection);
_______________________________________________
YaCy-svn mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yacy-svn