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/02/18 12:02:43 UTC

[tomcat] branch 8.5.x updated (552f1a6 -> 0b6f251)

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

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


    from 552f1a6  Align with 9.0.x
     new 6752a0b  Align with 9.0.x onwards - refactor timeoute
     new 0b6f251  Align with 9.0.x onwards - formatting

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/Nio2Endpoint.java |  4 +---
 java/org/apache/tomcat/util/net/NioEndpoint.java  | 25 +++++++++++++++++------
 2 files changed, 20 insertions(+), 9 deletions(-)

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


[tomcat] 02/02: Align with 9.0.x onwards - formatting

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

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

commit 0b6f2517beac4e884577407b773cae119dc3b17f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Feb 18 12:02:11 2022 +0000

    Align with 9.0.x onwards - formatting
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index e480490..6adf5d9 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -113,7 +113,6 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
 
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * Number of keep-alive sockets.
      *
@@ -141,7 +140,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
         if (getExecutor() instanceof ExecutorService) {
             threadGroup = AsynchronousChannelGroup.withThreadPool((ExecutorService) getExecutor());
         }
-        // AsynchronousChannelGroup currently needs exclusive access to its executor service
+        // AsynchronousChannelGroup needs exclusive access to its executor service
         if (!internalExecutor) {
             log.warn(sm.getString("endpoint.nio2.exclusiveExecutor"));
         }
@@ -486,7 +485,6 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
         }
     }
 
-
     public static class Nio2SocketWrapper extends SocketWrapperBase<Nio2Channel> {
 
         private SendfileData sendfileData = null;

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


[tomcat] 01/02: Align with 9.0.x onwards - refactor timeoute

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

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

commit 6752a0b60fdc0f706392ba285e36ce8439115624
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Feb 18 00:19:33 2022 +0000

    Align with 9.0.x onwards - refactor timeoute
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 25 ++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 4306052..6f31c0c 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1141,25 +1141,38 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                             processKey(key, socketWrapper);
                         } else if ((socketWrapper.interestOps() & SelectionKey.OP_READ) == SelectionKey.OP_READ ||
                                   (socketWrapper.interestOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) {
-                            boolean isTimedOut = false;
+                            boolean readTimeout = false;
+                            boolean writeTimeout = false;
                             // Check for read timeout
                             if ((socketWrapper.interestOps() & SelectionKey.OP_READ) == SelectionKey.OP_READ) {
                                 long delta = now - socketWrapper.getLastRead();
                                 long timeout = socketWrapper.getReadTimeout();
-                                isTimedOut = timeout > 0 && delta > timeout;
+                                if (timeout > 0 && delta > timeout) {
+                                    readTimeout = true;
+                                }
                             }
                             // Check for write timeout
-                            if (!isTimedOut && (socketWrapper.interestOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) {
+                            if (!readTimeout && (socketWrapper.interestOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) {
                                 long delta = now - socketWrapper.getLastWrite();
                                 long timeout = socketWrapper.getWriteTimeout();
-                                isTimedOut = timeout > 0 && delta > timeout;
+                                if (timeout > 0 && delta > timeout) {
+                                    writeTimeout = true;
+                                }
                             }
-                            if (isTimedOut) {
+                            if (readTimeout || writeTimeout) {
                                 key.interestOps(0);
                                 // Avoid duplicate timeout calls
                                 socketWrapper.interestOps(0);
                                 socketWrapper.setError(new SocketTimeoutException());
-                                if (!processSocket(socketWrapper, SocketEvent.ERROR, true)) {
+                                if (readTimeout && socketWrapper.readOperation != null) {
+                                    if (!socketWrapper.readOperation.process()) {
+                                        cancelledKey(key);
+                                    }
+                                } else if (writeTimeout && socketWrapper.writeOperation != null) {
+                                    if (!socketWrapper.writeOperation.process()) {
+                                        cancelledKey(key);
+                                    }
+                                } else if (!processSocket(socketWrapper, SocketEvent.ERROR, true)) {
                                     cancelledKey(key);
                                 }
                             }

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