more timeout-control

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3692 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent 24db55a541
commit 22a0e9f117

@ -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;
}
/*

@ -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;

@ -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;
}

@ -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));

Loading…
Cancel
Save