Author: remm
Date: Thu Apr 26 15:14:06 2018
New Revision: 1830233

URL: http://svn.apache.org/viewvc?rev=1830233&view=rev
Log:
Add quick hack to allow more careless use of the write call, to mirror what the 
read method does. It is inelegant as it will block (but it really shouldn't 
happen).

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1830233&r1=1830232&r2=1830233&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Apr 26 
15:14:06 2018
@@ -1110,6 +1110,15 @@ public class Nio2Endpoint extends Abstra
                     return CompletionState.NOT_DONE;
                 }
             }
+            if (!socketBufferHandler.isWriteBufferEmpty()) {
+                // First flush the main buffer as needed
+                try {
+                    doWrite(true);
+                } catch (IOException e) {
+                    handler.failed(e, attachment);
+                    return CompletionState.ERROR;
+                }
+            }
             OperationState<A> state = new OperationState<>(srcs, offset, 
length, block, timeout, unit, attachment, check, handler);
             GatherWriteCompletionHandler<A> completion = new 
GatherWriteCompletionHandler<>();
             Nio2Endpoint.startInline();



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

Reply via email to