Author: remm
Date: Thu Mar 23 02:54:30 2006
New Revision: 388137
URL: http://svn.apache.org/viewcvs?rev=388137&view=rev
Log:
- Add some new fisrtReadTimeout modes (mostly for Mladen's testing):
- 0: poller will be used for all keepalives (this one was the behavior if
fisrtReadTimeout <= 0),
and all the initial reads will have a short timeout
- -1: poller will be used for all keepalives, but all reads will use the
regular socket timeout
- < -1: all reads will use the regular socket timeout; the mode becomes
equivalent to -1 as soon
as more than maxThreads/2 are used
Modified:
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
Modified:
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=388137&r1=388136&r2=388137&view=diff
==============================================================================
---
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
(original)
+++
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
Thu Mar 23 02:54:30 2006
@@ -86,8 +86,10 @@
request = new Request();
int readTimeout = endpoint.getFirstReadTimeout();
- if (readTimeout <= 0) {
+ if (readTimeout == 0) {
readTimeout = 100;
+ } else if (readTimeout < 0) {
+ readTimeout = -1;
}
inputBuffer = new InternalAprInputBuffer(request, headerBufferSize,
readTimeout);
@@ -763,7 +765,7 @@
long soTimeout = endpoint.getSoTimeout();
int limit = 0;
- if (endpoint.getFirstReadTimeout() > 0) {
+ if (endpoint.getFirstReadTimeout() > 0 ||
endpoint.getFirstReadTimeout() < -1) {
limit = endpoint.getMaxThreads() / 2;
}
Modified:
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=388137&r1=388136&r2=388137&view=diff
==============================================================================
---
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
(original)
+++
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
Thu Mar 23 02:54:30 2006
@@ -73,7 +73,11 @@
parsingHeader = true;
swallowInput = true;
- this.readTimeout = readTimeout * 1000;
+ if (readTimeout < 0) {
+ this.readTimeout = -1;
+ } else {
+ this.readTimeout = readTimeout * 1000;
+ }
}
@@ -404,19 +408,24 @@
if (useAvailableData) {
return false;
}
- // Do a simple read with a short timeout
- bbuf.clear();
- int nRead = Socket.recvbbt
- (socket, 0, buf.length - lastValid, readTimeout);
- if (nRead > 0) {
- bbuf.limit(nRead);
- bbuf.get(buf, pos, nRead);
- lastValid = pos + nRead;
+ if (readTimeout == -1) {
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
} else {
- if ((-nRead) == Status.ETIMEDOUT || (-nRead) ==
Status.TIMEUP) {
- return false;
+ // Do a simple read with a short timeout
+ bbuf.clear();
+ int nRead = Socket.recvbbt
+ (socket, 0, buf.length - lastValid, readTimeout);
+ if (nRead > 0) {
+ bbuf.limit(nRead);
+ bbuf.get(buf, pos, nRead);
+ lastValid = pos + nRead;
} else {
- throw new IOException(sm.getString("iib.failedread"));
+ if ((-nRead) == Status.ETIMEDOUT || (-nRead) ==
Status.TIMEUP) {
+ return false;
+ } else {
+ throw new
IOException(sm.getString("iib.failedread"));
+ }
}
}
}
@@ -434,19 +443,24 @@
if (useAvailableData) {
return false;
}
- // Do a simple read with a short timeout
- bbuf.clear();
- int nRead = Socket.recvbbt
- (socket, 0, buf.length - lastValid, readTimeout);
- if (nRead > 0) {
- bbuf.limit(nRead);
- bbuf.get(buf, pos, nRead);
- lastValid = pos + nRead;
+ if (readTimeout == -1) {
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
} else {
- if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP)
{
- return false;
+ // Do a simple read with a short timeout
+ bbuf.clear();
+ int nRead = Socket.recvbbt
+ (socket, 0, buf.length - lastValid, readTimeout);
+ if (nRead > 0) {
+ bbuf.limit(nRead);
+ bbuf.get(buf, pos, nRead);
+ lastValid = pos + nRead;
} else {
- throw new IOException(sm.getString("iib.failedread"));
+ if ((-nRead) == Status.ETIMEDOUT || (-nRead) ==
Status.TIMEUP) {
+ return false;
+ } else {
+ throw new IOException(sm.getString("iib.failedread"));
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]