You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/05/26 06:37:53 UTC

[tomcat] branch 9.0.x updated (145a073f47 -> a56d50974d)

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

markt pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


    from 145a073f47 Fix indent
     new fc194b72d1 Only check state.hasOutboundRemaining() when writes complete.
     new a56d50974d Refactor to reduce code volume. Thanks to schultz.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/tomcat/util/net/AprEndpoint.java       | 7 -------
 java/org/apache/tomcat/util/net/Nio2Endpoint.java      | 7 -------
 java/org/apache/tomcat/util/net/SocketWrapperBase.java | 9 +++++++--
 3 files changed, 7 insertions(+), 16 deletions(-)


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


[tomcat] 01/02: Only check state.hasOutboundRemaining() when writes complete.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit fc194b72d1df42494c34cbc0937a42ad56559148
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu May 26 07:34:58 2022 +0100

    Only check state.hasOutboundRemaining() when writes complete.
    
    Review from remm
---
 java/org/apache/tomcat/util/net/SocketWrapperBase.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index d95a31a15d..ecfc0b7aff 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -1089,7 +1089,7 @@ public abstract class SocketWrapperBase<E> {
                 boolean completion = true;
                 if (state.check != null) {
                     CompletionHandlerCall call = state.check.callHandler(currentState, state.buffers, state.offset, state.length);
-                    if (call == CompletionHandlerCall.CONTINUE || state.hasOutboundRemaining()) {
+                    if (call == CompletionHandlerCall.CONTINUE || (!state.read && state.hasOutboundRemaining())) {
                         complete = false;
                     } else if (call == CompletionHandlerCall.NONE) {
                         completion = false;


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


[tomcat] 02/02: Refactor to reduce code volume. Thanks to schultz.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a56d50974d6cd6af019e09c0f260e76bc0b341b7
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu May 26 07:37:42 2022 +0100

    Refactor to reduce code volume. Thanks to schultz.
---
 java/org/apache/tomcat/util/net/AprEndpoint.java       | 7 -------
 java/org/apache/tomcat/util/net/Nio2Endpoint.java      | 7 -------
 java/org/apache/tomcat/util/net/SocketWrapperBase.java | 7 ++++++-
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 20d10efa11..c02e90fc09 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2813,13 +2813,6 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB
                 return inline;
             }
 
-            @Override
-            protected boolean hasOutboundRemaining() {
-                // NIO2 never has remaining outbound data when the completion
-                // handler is called
-                return false;
-            }
-
             @Override
             public void run() {
                 // Perform the IO operation
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index c5b9a395f5..49ee411016 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1021,13 +1021,6 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
                 return Nio2Endpoint.isInline();
             }
 
-            @Override
-            protected boolean hasOutboundRemaining() {
-                // NIO2 never has remaining outbound data when the completion
-                // handler is called
-                return false;
-            }
-
             @Override
             protected void start() {
                 if (read) {
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index ecfc0b7aff..cd869fbe3b 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -1036,7 +1036,12 @@ public abstract class SocketWrapperBase<E> {
          */
         protected abstract boolean isInline();
 
-        protected abstract boolean hasOutboundRemaining();
+        protected boolean hasOutboundRemaining() {
+            // NIO2 and APR never have remaining outbound data when the
+            // completion handler is called. NIO needs to override this.
+            return false;
+        }
+
 
         /**
          * Process the operation using the connector executor.


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