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

Commit c0e7fc8

Browse files
authored
Merge pull request #267 from Lukasa/closed-stream-windows
Fixup opening windows of closed streams.
2 parents 1cbc63c + d59bce5 commit c0e7fc8

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ script:
3434
py.test test/
3535
else
3636
coverage run -m py.test test/
37-
coverage combine
3837
coverage report
3938
fi
4039
fi

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
"""

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ envlist = py27, py34, py35, pypy, lint
55
deps= -r{toxinidir}/test_requirements.txt
66
commands=
77
coverage run -m py.test {toxinidir}/test/
8-
coverage combine
98
coverage report
109

1110
[testenv:pypy]

0 commit comments

Comments
 (0)