tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38464] - Data corruption when using APR
Date Tue, 07 Feb 2006 12:06:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


remm@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From remm@apache.org  2006-02-07 13:06 -------
Yes, the APR API seems more closely related to java.nio, but I am too used to
java.io. Since I don't want to compromise usage of the API in non blocking
situations, it is probably better to do the loop in Java.

The Java patch applied is (hopefully it's correct, please test it):

Modified:
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=375582&r1=375581&r2=375582&view=diff
==============================================================================
---
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
(original)
+++
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Tue Feb  7 03:47:20 2006
@@ -695,9 +695,14 @@
     protected void flushBuffer()
         throws IOException {
         if (bbuf.position() > 0) {
-            if (Socket.sendbb(socket, 0, bbuf.position()) < 0) {
-                throw new IOException(sm.getString("iib.failedwrite"));
-            }
+            int i = 0;
+            int n = 0;
+            do {
+                if ((n = Socket.sendbb(socket, i, bbuf.position())) < 0) {
+                    throw new IOException();
+                }
+                i += n;
+            } while (i < bbuf.position());
             bbuf.clear();
         }
     }



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message