This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 2eb64d1  Cleanup
2eb64d1 is described below

commit 2eb64d1d18196b1ada18b6d435055b7d93c4f7ce
Author: remm <r...@apache.org>
AuthorDate: Tue Apr 30 10:41:48 2019 +0200

    Cleanup
    
    Add two utility read completion checks. Actually, the code is the same
    as for write. Also use hasRemaining.
---
 java/org/apache/tomcat/util/net/SocketWrapperBase.java | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index ea14e2c..cd2e619 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -892,7 +892,7 @@ public abstract class SocketWrapperBase<E> {
         public CompletionHandlerCall callHandler(CompletionState state, 
ByteBuffer[] buffers,
                 int offset, int length) {
             for (int i = 0; i < length; i++) {
-                if (buffers[offset + i].remaining() > 0) {
+                if (buffers[offset + i].hasRemaining()) {
                     return CompletionHandlerCall.CONTINUE;
                 }
             }
@@ -910,7 +910,7 @@ public abstract class SocketWrapperBase<E> {
         public CompletionHandlerCall callHandler(CompletionState state, 
ByteBuffer[] buffers,
                 int offset, int length) {
             for (int i = 0; i < length; i++) {
-                if (buffers[offset + i].remaining() > 0) {
+                if (buffers[offset + i].hasRemaining()) {
                     return CompletionHandlerCall.CONTINUE;
                 }
             }
@@ -933,6 +933,20 @@ public abstract class SocketWrapperBase<E> {
     };
 
     /**
+     * This utility CompletionCheck will cause the completion handler
+     * to be called once the given buffers are full. The completion
+     * handler will then be called.
+     */
+    public static final CompletionCheck COMPLETE_READ_WITH_COMPLETION = 
COMPLETE_WRITE_WITH_COMPLETION;
+
+    /**
+     * This utility CompletionCheck will cause the completion handler
+     * to be called once the given buffers are full. If the operation
+     * completes inline, the completion handler will not be called.
+     */
+    public static final CompletionCheck COMPLETE_READ = COMPLETE_WRITE;
+
+    /**
      * Allows using NIO2 style read/write only for connectors that can
      * efficiently support it.
      *


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

Reply via email to