Author: markt
Date: Wed Feb 4 21:35:47 2015
New Revision: 1657406
URL: http://svn.apache.org/r1657406
Log:
Fix another source of multiple write registrations.
Modified:
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
Modified:
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java?rev=1657406&r1=1657405&r2=1657406&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
(original)
+++
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
Wed Feb 4 21:35:47 2015
@@ -74,9 +74,15 @@ public class UpgradeServletOutputStream
// fireListener when determining if the listener should fire
synchronized (fireListenerLock) {
if (flushing) {
- socketWrapper.registerWriteInterest();
+ // Since flushing is true the socket must already be registered
+ // for write and multiple registrations will cause problems.
fireListener = true;
return false;
+ } else if (fireListener){
+ // If the listener is configured to fire then the socket must
+ // already be registered for write and multiple registrations
+ // will cause problems.
+ return false;
} else {
boolean result = socketWrapper.isReadyForWrite();
fireListener = !result;
@@ -141,6 +147,9 @@ public class UpgradeServletOutputStream
synchronized (writeLock) {
if (updateFlushing) {
flushing = socketWrapper.flush(block);
+ if (flushing) {
+ socketWrapper.registerWriteInterest();
+ }
} else {
socketWrapper.flush(block);
}
@@ -187,7 +196,6 @@ public class UpgradeServletOutputStream
if (flushing) {
flushInternal(false, true);
if (flushing) {
- socketWrapper.registerWriteInterest();
return;
}
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]