Skip to content

Commit 4312d3e

Browse files
committed
Streams must not depend on themselves.
1 parent 4c89292 commit 4312d3e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/priority/priority.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ def insert_stream(self,
348348

349349
if not depends_on:
350350
depends_on = 0
351+
elif depends_on == stream_id:
352+
raise PriorityLoop(
353+
"Stream %d must not depend on itself." % stream_id
354+
)
351355

352356
if exclusive:
353357
parent_stream = self._get_or_insert_parent(depends_on)
@@ -389,6 +393,11 @@ def reprioritize(self,
389393
# own dependents. Then, we remove this stream from its current parent
390394
# and move it to its new parent, taking its children with it.
391395
if depends_on:
396+
if depends_on == stream_id:
397+
raise PriorityLoop(
398+
"Stream %d must not depend on itself" % stream_id
399+
)
400+
392401
new_parent = self._get_or_insert_parent(depends_on)
393402
cycle = _stream_cycle(new_parent, current_stream)
394403
else:

0 commit comments

Comments
 (0)