Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit f50fad8

Browse files
committed
Fixup opening windows of closed streams.
1 parent 1cbc63c commit f50fad8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

hyper/http20/stream.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,19 @@ def receive_data(self, event):
186186
# Append the data to the buffer.
187187
self.data.append(event.data)
188188

189-
stream_about_to_close = (event.stream_ended is not None)
190-
191-
if increment and not self.remote_closed and not stream_about_to_close:
192-
with self._conn as conn:
193-
conn.increment_flow_control_window(
194-
increment, stream_id=self.stream_id
195-
)
196-
self._send_outstanding_data()
189+
if increment:
190+
try:
191+
with self._conn as conn:
192+
conn.increment_flow_control_window(
193+
increment, stream_id=self.stream_id
194+
)
195+
except h2.exceptions.StreamClosedError:
196+
# We haven't got to it yet, but the stream is already
197+
# closed. We don't need to increment the window in this
198+
# case!
199+
pass
200+
else:
201+
self._send_outstanding_data()
197202

198203
def receive_end_stream(self, event):
199204
"""

0 commit comments

Comments
 (0)