prevent early priority changes

This commit is contained in:
Thomas Kriechbaumer 2016-07-05 20:59:02 +02:00
parent 1adcd6ad6b
commit 50fdb01553

View File

@ -206,10 +206,15 @@ class Http2Layer(base.Layer):
self.streams[event.pushed_stream_id].request_data_finished.set() self.streams[event.pushed_stream_id].request_data_finished.set()
self.streams[event.pushed_stream_id].start() self.streams[event.pushed_stream_id].start()
elif isinstance(event, events.PriorityUpdated): elif isinstance(event, events.PriorityUpdated):
if self.streams[eid].handled_priority_event is event: if eid in self.streams:
# This event was already handled during stream creation if self.streams[eid].handled_priority_event is event:
# HeadersFrame + Priority information as RequestReceived # This event was already handled during stream creation
return True # HeadersFrame + Priority information as RequestReceived
return True
if eid in self.streams:
self.streams[eid].priority_weight = event.weight
self.streams[eid].priority_depends_on = event.depends_on
self.streams[eid].priority_exclusive = event.exclusive
stream_id = event.stream_id stream_id = event.stream_id
if stream_id in self.streams.keys() and self.streams[stream_id].server_stream_id: if stream_id in self.streams.keys() and self.streams[stream_id].server_stream_id:
@ -219,10 +224,6 @@ class Http2Layer(base.Layer):
if depends_on in self.streams.keys() and self.streams[depends_on].server_stream_id: if depends_on in self.streams.keys() and self.streams[depends_on].server_stream_id:
depends_on = self.streams[depends_on].server_stream_id depends_on = self.streams[depends_on].server_stream_id
self.streams[eid].priority_weight = event.weight
self.streams[eid].priority_depends_on = event.depends_on
self.streams[eid].priority_exclusive = event.exclusive
with self.server_conn.h2.lock: with self.server_conn.h2.lock:
self.server_conn.h2.prioritize( self.server_conn.h2.prioritize(
stream_id, stream_id,