Skip to content

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

more timeout-control

orbiter22a0e9f117b9
diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.java
index 06f011e9c..235ac609f 100644
--- a/source/de/anomic/http/httpHeader.java
+++ b/source/de/anomic/http/httpHeader.java
@@ -705,6 +705,7 @@ public final class httpHeader extends TreeMap implements Map {
httpHeader header = new httpHeader(httpd.reverseMappingCache);
int p;
String line;
+ long start = System.currentTimeMillis();
while ((line = theSession.readLineAsString()) != null) {
if (line.length() == 0) break; // this seperates the header of the HTTP request from the body
// parse the header line: a property seperated with the ':' sign
@@ -712,6 +713,7 @@ public final class httpHeader extends TreeMap implements Map {
// store a property
header.add(line.substring(0, p).trim(), line.substring(p + 1).trim());
}
+ if (System.currentTimeMillis() - start > theSession.socketTimeout) break;
}
/*
diff --git a/source/de/anomic/icap/icapHeader.java b/source/de/anomic/icap/icapHeader.java
index 70e9d091b..3274250b3 100644
--- a/source/de/anomic/icap/icapHeader.java
+++ b/source/de/anomic/icap/icapHeader.java
@@ -290,6 +290,7 @@ public class icapHeader extends TreeMap implements Map {
icapHeader header = new icapHeader();
int p;
String line;
+ long start = System.currentTimeMillis();
while ((line = theSession.readLineAsString()) != null) {
if (line.length() == 0) break; // this seperates the header of the HTTP request from the body
// parse the header line: a property seperated with the ':' sign
@@ -297,6 +298,7 @@ public class icapHeader extends TreeMap implements Map {
// store a property
header.add(line.substring(0, p).trim(), line.substring(p + 1).trim());
}
+ if (System.currentTimeMillis() - start > theSession.socketTimeout) break;
}
return header;
diff --git a/source/de/anomic/kelondro/kelondroRowSet.java b/source/de/anomic/kelondro/kelondroRowSet.java
index 95afd9e5c..1b3db4e23 100644
--- a/source/de/anomic/kelondro/kelondroRowSet.java
+++ b/source/de/anomic/kelondro/kelondroRowSet.java
@@ -114,7 +114,7 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroInd
super.removeRow(index);
//System.out.println("remove: chunk found at index position (after remove) " + index + ", inset=" + serverLog.arrayList(super.chunkcache, super.rowdef.objectsize() * index, length) + ", searchkey=" + serverLog.arrayList(a, start, length));
int findagainindex = find(a, start, length);
- assert findagainindex < 0 : "remove: chunk found again at index position (after remove) " + findagainindex + ", inset=" + serverLog.arrayList(super.chunkcache, super.rowdef.objectsize() * findagainindex, length) + ", searchkey=" + serverLog.arrayList(a, start, length); // check if the remove worked
+ assert findagainindex < 0 : "remove: chunk found again at index position (after remove) " + findagainindex + ", index(before) = " + index + ", inset=" + serverLog.arrayList(super.chunkcache, super.rowdef.objectsize() * findagainindex, length) + ", searchkey=" + serverLog.arrayList(a, start, length); // check if the remove worked
return entry;
}
diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java
index b75d71bc8..799abb95b 100644
--- a/source/de/anomic/server/serverCore.java
+++ b/source/de/anomic/server/serverCore.java
@@ -900,7 +900,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
public int userPort; // the ip port used by the client
public PushbackInputStream in; // on control input stream
public OutputStream out; // on control output stream, autoflush
- private int socketTimeout;
+ public int socketTimeout;
private final serverByteBuffer readLineBuffer = new serverByteBuffer(256);
@@ -1155,10 +1155,14 @@ public final class serverCore extends serverAbstractThread implements serverThre
String reqCmd;
String reqProtocol = "HTTP";
Object[] stringParameter = new String[1];
- while ((this.in != null) && ((requestBytes = readLine()) != null)) {
+ long starttime = System.currentTimeMillis();
+ while ((this.in != null) &&
+ ((requestBytes = readLine()) != null) &&
+ (System.currentTimeMillis() - starttime < serverCore.this.timeout)) {
this.setName("Session_" + this.userAddress.getHostAddress() +
- ":" + this.controlSocket.getPort() +
- "#" + this.commandCounter);
+ ":" + this.controlSocket.getPort() +
+ "_#=" + this.commandCounter +
+ "_T=" + (System.currentTimeMillis() - starttime));
this.request = new String(requestBytes);
//log.logDebug("* session " + handle + " received command '" + request + "'. time = " + (System.currentTimeMillis() - handle));