You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2007/10/20 17:49:58 UTC

svn commit: r586748 - /tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/InternalNioOutputBuffer.java

Author: fhanik
Date: Sat Oct 20 08:49:58 2007
New Revision: 586748

URL: http://svn.apache.org/viewvc?rev=586748&view=rev
Log:
bring sand box up to date with patches from 6.0

Modified:
    tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/InternalNioOutputBuffer.java

Modified: tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=586748&r1=586747&r2=586748&view=diff
==============================================================================
--- tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/InternalNioOutputBuffer.java (original)
+++ tomcat/sandbox/gdev6x/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Sat Oct 20 08:49:58 2007
@@ -401,7 +401,7 @@
     // ------------------------------------------------ HTTP/1.1 Output Methods
 
 
-    /**
+    /** 
      * Send an acknoledgement.
      */
     public void sendAck()
@@ -409,8 +409,8 @@
 
         if (!committed) {
             //Socket.send(socket, Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length) < 0
-            ByteBuffer buf = ByteBuffer.wrap(Constants.ACK_BYTES,0,Constants.ACK_BYTES.length);    
-            writeToSocket(buf,true);
+            socket.getBufHandler() .getWriteBuffer().put(Constants.ACK_BYTES,0,Constants.ACK_BYTES.length);    
+            writeToSocket(socket.getBufHandler() .getWriteBuffer(),true,true);
         }
 
     }
@@ -423,11 +423,8 @@
      * @throws IOException
      * @todo Fix non blocking write properly
      */
-    private synchronized int writeToSocket(ByteBuffer bytebuffer, boolean block) throws IOException {
-        if (socket.getBufHandler().getWriteBuffer() != bytebuffer) {
-            socket.getBufHandler().getWriteBuffer().put(bytebuffer);
-            bytebuffer = socket.getBufHandler().getWriteBuffer();
-        }
+    private synchronized int writeToSocket(ByteBuffer bytebuffer, boolean block, boolean flip) throws IOException {
+        if ( flip ) bytebuffer.flip();
 
         int written = 0;
         NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
@@ -770,7 +767,7 @@
         //write to the socket, if there is anything to write
         if (socket.getBufHandler().getWriteBuffer().position() > 0) {
             socket.getBufHandler().getWriteBuffer().flip();
-            writeToSocket(socket.getBufHandler().getWriteBuffer(),true);
+            writeToSocket(socket.getBufHandler().getWriteBuffer(),true, false);
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org