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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new f86339e  Simplify - remove need for nested calls.
f86339e is described below

commit f86339e82ef70ed400979cb3891617f106484491
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Aug 1 13:43:13 2019 +0100

    Simplify - remove need for nested calls.
---
 java/org/apache/coyote/http2/AbstractStream.java | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/coyote/http2/AbstractStream.java 
b/java/org/apache/coyote/http2/AbstractStream.java
index e2105fb..55a5c2c 100644
--- a/java/org/apache/coyote/http2/AbstractStream.java
+++ b/java/org/apache/coyote/http2/AbstractStream.java
@@ -70,15 +70,13 @@ abstract class AbstractStream {
 
 
     boolean isDescendant(AbstractStream stream) {
-        if (childStreams.contains(stream)) {
-            return true;
+        // Is the passed in Stream a descendant of this Stream?
+        // Start at the passed in Stream and work up
+        AbstractStream parent = stream.getParentStream();
+        while (parent != null && parent != this) {
+            parent = parent.getParentStream();
         }
-        for (AbstractStream child : childStreams) {
-            if (child.isDescendant(stream)) {
-                return true;
-            }
-        }
-        return false;
+        return parent != null;
     }
 
 


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

Reply via email to