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


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

commit 3fa669073177694275c2ae0e8c2b82f471c31da0
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                         | 10 ++++++++
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 468ab3e984..b636e9fa16 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -1261,21 +1261,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 04a6fd0822..adf1d27ef2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,16 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.91 (remm)" rtext="in development">
+  <subsection name="Coyote">
+    <changelog>
+      <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>
 </section>
 <section name="Tomcat 9.0.90 (remm)" rtext="release in progress">
   <subsection name="Catalina">


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

Reply via email to