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

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 8b771c81e033eedde168bba1ab028ac850a1689e
Author: lihan <aooo...@gmail.com>
AuthorDate: Mon Jul 18 12:52:11 2022 +0800

    Duplicate accept checks are not required in unix domain socket mode
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 4 ++--
 java/org/apache/tomcat/util/net/NioEndpoint.java | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 5b7c457880..fa765f1ad3 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -813,8 +813,8 @@ public class AprEndpoint extends 
AbstractEndpoint<Long,Long> implements SNICallB
             // Do the duplicate accept check here rather than in 
serverSocketaccept()
             // so we can cache the results in the SocketWrapper
             AprSocketWrapper wrapper = new AprSocketWrapper(socket, this);
-            // Bug does not affect Windows. Skip the check on that platform.
-            if (!JrePlatform.IS_WINDOWS) {
+            // Bug does not affect Windows platform and Unix Domain Socket. 
Skip the check.
+            if (!JrePlatform.IS_WINDOWS && getUnixDomainSocketPath() == null) {
                 long currentNanoTime = System.nanoTime();
                 if (wrapper.getRemotePort() == previousAcceptedPort) {
                     if 
(wrapper.getRemoteAddr().equals(previousAcceptedAddress)) {
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index ddcdcd39ab..fbd860741f 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -519,8 +519,8 @@ public class NioEndpoint extends 
AbstractJsseEndpoint<NioChannel,SocketChannel>
     protected SocketChannel serverSocketAccept() throws Exception {
         SocketChannel result = serverSock.accept();
 
-        // Bug does not affect Windows. Skip the check on that platform.
-        if (!JrePlatform.IS_WINDOWS) {
+        // Bug does not affect Windows platform and Unix Domain Socket. Skip 
the check.
+        if (!JrePlatform.IS_WINDOWS && getUnixDomainSocketPath() == null) {
             SocketAddress currentRemoteAddress = result.getRemoteAddress();
             long currentNanoTime = System.nanoTime();
             if 
(currentRemoteAddress.equals(previousAcceptedSocketRemoteAddress) &&


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

Reply via email to