Avoid infinite loop in HTTP/2 distributor toString()

Motivation:

Although effectively unused, the toString() of
WeightedFairQueueByteDistributor.State is useful for debugging. It
accidentally had an infinite loop, as it would recurse infinitely
between a parent and its child, which makes it less useful for
debugging.

Modifications:

Prune the infinite loop by using the parent's streamId instead of the
parent's toString().

Result:

Faster, less stack-overflowing toString()
This commit is contained in:
Eric Anderson 2017-04-21 17:15:18 -07:00 committed by Scott Mitchell
parent 7214740c06
commit c6ad9338b3

View File

@ -770,7 +770,7 @@ public final class WeightedFairQueueByteDistributor implements StreamByteDistrib
.append(" flags ").append(flags)
.append(" pseudoTimeQueue.size() ").append(pseudoTimeQueue.size())
.append(" stateOnlyQueueIndex ").append(stateOnlyQueueIndex)
.append(" parent ").append(parent).append("} [");
.append(" parent.streamId ").append(parent == null ? -1 : parent.streamId).append("} [");
if (!pseudoTimeQueue.isEmpty()) {
for (State s : pseudoTimeQueue) {