Author: remm
Date: Mon Apr 30 16:39:41 2007
New Revision: 533882

URL: http://svn.apache.org/viewvc?view=rev&rev=533882
Log:
- Obvious typo in didRead. Ooops. Maybe Eclipse did that.
- Return 1 for available when using a Comet read and no real read was done 
(actually, it could well be good enough
  to only use didRead to get an "accurate" available() method, but it could 
probably be useful for blocking IO).

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java?view=diff&rev=533882&r1=533881&r2=533882
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/InputBuffer.java 
Mon Apr 30 16:39:41 2007
@@ -101,7 +101,7 @@
     /**
      * Flag which if a read was performed.
      */
-    private boolean didRead = false;
+    private boolean didRead = true;
 
 
     /**
@@ -274,12 +274,20 @@
             coyoteRequest.action(ActionCode.ACTION_AVAILABLE, null);
             available = (coyoteRequest.getAvailable() > 0) ? 1 : 0;
         }
+        if ((available == 0) && !didRead) {
+            // This is a comet read and no read was done: at least one
+            // read can be made without blocking (in very rare cases, it will
+            // reach the end of the stream, for example if the bytes sent 
+            // were from a next request, or if the request content-length is
+            // wrong)
+            available = 1;
+        }
         return available;
     }
 
 
     public boolean didRead() {
-        return didRead();
+        return didRead;
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to