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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 3203c2dac4 Improve the acceptor unlock process
3203c2dac4 is described below

commit 3203c2dac40c6eba93ab584e4f9ff4a5c432e368
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jun 14 20:11:32 2024 +0100

    Improve the acceptor unlock process
---
 .../apache/tomcat/util/net/AbstractEndpoint.java   | 30 ++++++++++++----------
 webapps/docs/changelog.xml                         |  6 +++++
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 26040fd0d9..af06a1d202 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -1192,21 +1192,23 @@ public abstract class AbstractEndpoint<S,U> {
             Enumeration<NetworkInterface> networkInterfaces = 
NetworkInterface.getNetworkInterfaces();
             while (networkInterfaces.hasMoreElements()) {
                 NetworkInterface networkInterface = 
networkInterfaces.nextElement();
-                Enumeration<InetAddress> inetAddresses = 
networkInterface.getInetAddresses();
-                while (inetAddresses.hasMoreElements()) {
-                    InetAddress inetAddress = inetAddresses.nextElement();
-                    if 
(localAddress.getAddress().getClass().isAssignableFrom(inetAddress.getClass())) 
{
-                        if (inetAddress.isLoopbackAddress()) {
-                            if (loopbackUnlockAddress == null) {
-                                loopbackUnlockAddress = inetAddress;
+                if (!networkInterface.isPointToPoint() && 
networkInterface.isUp()) {
+                    Enumeration<InetAddress> inetAddresses = 
networkInterface.getInetAddresses();
+                    while (inetAddresses.hasMoreElements()) {
+                        InetAddress inetAddress = inetAddresses.nextElement();
+                        if 
(localAddress.getAddress().getClass().isAssignableFrom(inetAddress.getClass())) 
{
+                            if (inetAddress.isLoopbackAddress()) {
+                                if (loopbackUnlockAddress == null) {
+                                    loopbackUnlockAddress = inetAddress;
+                                }
+                            } else if (inetAddress.isLinkLocalAddress()) {
+                                if (linkLocalUnlockAddress == null) {
+                                    linkLocalUnlockAddress = inetAddress;
+                                }
+                            } else {
+                                // Use a non-link local, non-loop back address 
by default
+                                return new InetSocketAddress(inetAddress, 
localAddress.getPort());
                             }
-                        } else if (inetAddress.isLinkLocalAddress()) {
-                            if (linkLocalUnlockAddress == null) {
-                                linkLocalUnlockAddress = inetAddress;
-                            }
-                        } else {
-                            // Use a non-link local, non-loop back address by 
default
-                            return new InetSocketAddress(inetAddress, 
localAddress.getPort());
                         }
                     }
                 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 09da98d76c..055aad9e85 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -168,6 +168,12 @@
       <add>
         Add support for TLS 1.3 client initiated re-keying. (markt)
       </add>
+      <fix>
+        Improve the algorithm used to identify the IP address to use to unlock
+        the acceptor thread when a Connector is listening on all local
+        addresses. Interfaces that are configured for point to point 
connections
+        or are not currently up are now skipped. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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

Reply via email to