Author: remy.maucherat(a)jboss.com
Date: 2008-02-27 16:44:34 -0500 (Wed, 27 Feb 2008)
New Revision: 453
Modified:
trunk/java/org/apache/catalina/connector/OutputBuffer.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Log:
- Add a protection against calling ready or resume multiple times.
Modified: trunk/java/org/apache/catalina/connector/OutputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/OutputBuffer.java 2008-02-27 16:17:46 UTC
(rev 452)
+++ trunk/java/org/apache/catalina/connector/OutputBuffer.java 2008-02-27 21:44:34 UTC
(rev 453)
@@ -330,7 +330,6 @@
protected int lastWrite() {
int res = coyoteResponse.getLastWrite();
if (res == 0) {
- // FIXME: For efficiency, it would be nice to check if not calling it twice,
and reset than when that is done
coyoteResponse.action(ActionCode.ACTION_COMET_WRITE, null);
}
return res;
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-02-27 16:17:46 UTC
(rev 452)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-02-27 21:44:34 UTC
(rev 453)
@@ -1283,19 +1283,17 @@
readNotifications = true;
// An event is being processed already: adding for resume will be done
// when the socket gets back to the poller
- if (cometProcessing) {
- resumeNotification = true;
- } else {
+ if (!cometProcessing && !resumeNotification) {
endpoint.getCometPoller().add(socket, timeout, false, false, true);
}
+ resumeNotification = true;
} else if (actionCode == ActionCode.ACTION_COMET_WRITE) {
// An event is being processed already: adding for write will be done
// when the socket gets back to the poller
- if (cometProcessing) {
- writeNotification = true;
- } else {
+ if (!cometProcessing && !writeNotification) {
endpoint.getCometPoller().add(socket, timeout, false, true, false);
}
+ writeNotification = true;
} else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
cometTimeout = ((Integer) param).intValue();
}
Modified: trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2008-02-27 16:17:46
UTC (rev 452)
+++ trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2008-02-27 21:44:34
UTC (rev 453)
@@ -766,7 +766,6 @@
// - If the call is asynchronous, throw an exception
// - If the call is synchronous, make a regular blocking write to flush
the data
if (leftover.getLength() > 0) {
- // FIXME: the fact that it's a container thread was already
tested in doWrite
if (Http11AprProcessor.containerThread.get() == Boolean.TRUE) {
Socket.optSet(socket, Socket.APR_SO_NONBLOCK, 0);
// Also use the usual timeout
@@ -799,7 +798,7 @@
if (pos < end) {
leftover.allocate(end - pos, -1);
bbuf.get(leftover.getBuffer(), 0, end - pos);
- leftover.setEnd(end-pos);
+ leftover.setEnd(end - pos);
}
}
} else {
Show replies by date