Author: mturk
Date: Sun Oct 29 08:50:07 2006
New Revision: 468936

URL: http://svn.apache.org/viewvc?view=rev&rev=468936
Log:
On explicit flush, create an empty (8 bytes)
SEND_BODY_CHUNK message, that can be used by
web server to flush the packet.

Modified:
    tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Modified: 
tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java?view=diff&rev=468936&r1=468935&r2=468936
==============================================================================
--- tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java 
(original)
+++ tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java 
Sun Oct 29 08:50:07 2006
@@ -262,6 +262,10 @@
      */
     protected static final byte[] endMessageArray;
 
+    /**
+     * Direct buffer used for sending explicit flush message.
+     */
+    protected static final ByteBuffer flushMessageBuffer;
 
     // ----------------------------------------------------- Static Initializer
 
@@ -298,6 +302,18 @@
         System.arraycopy(endMessage.getBuffer(), 0, endMessageArray, 0,
                 endMessage.getLen());
 
+        // Set the flush message buffer
+        AjpMessage flushMessage = new AjpMessage();
+        flushMessage.reset();
+        flushMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK);
+        flushMessage.appendInt(0);
+        flushMessage.appendByte(0);
+        flushMessage.end();
+        flushMessageBuffer =
+            ByteBuffer.allocateDirect(flushMessage.getLen());
+        flushMessageBuffer.put(flushMessage.getBuffer(), 0,
+                flushMessage.getLen());
+
     }
 
 
@@ -510,6 +526,11 @@
 
             try {
                 flush();
+                // Send explicit flush message
+                if (Socket.sendb(socket, flushMessageBuffer, 0,
+                                 flushMessageBuffer.position()) < 0) {
+                    error = true;                    
+                }
             } catch (IOException e) {
                 // Set error flag
                 error = true;



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

Reply via email to