You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2014/03/21 20:55:48 UTC

svn commit: r1580033 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

Author: remm
Date: Fri Mar 21 19:55:48 2014
New Revision: 1580033

URL: http://svn.apache.org/r1580033
Log:
Forgot to check the return value for blocking writes as all other places do, oops (some platforms could be returning a negative value after a disconnect rather than throw an exception).

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1580033&r1=1580032&r2=1580033&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java Fri Mar 21 19:55:48 2014
@@ -384,12 +384,16 @@ public class InternalNio2OutputBuffer ex
                     if (bufferedWrites.size() > 0) {
                         for (ByteBuffer buffer : bufferedWrites) {
                             buffer.flip();
-                            socket.getSocket().write(buffer).get(socket.getTimeout(), TimeUnit.MILLISECONDS);
+                            if (socket.getSocket().write(buffer).get(socket.getTimeout(), TimeUnit.MILLISECONDS).intValue() < 0) {
+                                throw new EOFException(sm.getString("iob.failedwrite"));
+                            }
                         }
                         bufferedWrites.clear();
                     }
                     if (byteBuffer.hasRemaining()) {
-                        socket.getSocket().write(byteBuffer).get(socket.getTimeout(), TimeUnit.MILLISECONDS);
+                        if (socket.getSocket().write(byteBuffer).get(socket.getTimeout(), TimeUnit.MILLISECONDS).intValue() < 0) {
+                            throw new EOFException(sm.getString("iob.failedwrite"));
+                        }
                     }
                 } catch (InterruptedException | ExecutionException e) {
                     throw new IOException(e);



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