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 2019/08/01 12:43:35 UTC

[tomcat] branch master updated: Simplify - remove need for nested calls.

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

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


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

commit 63d98764d682c9e2f62d3c7bdd1c5255c4307200
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 fac522d..3c8c904 100644
--- a/java/org/apache/coyote/http2/AbstractStream.java
+++ b/java/org/apache/coyote/http2/AbstractStream.java
@@ -69,15 +69,13 @@ abstract class AbstractStream {
 
 
     final 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org