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

Commit

Permalink
Merge pull request #267 from Lukasa/closed-stream-windows
Browse files Browse the repository at this point in the history
Fixup opening windows of closed streams.
  • Loading branch information
Lukasa committed Aug 5, 2016
2 parents 1cbc63c + d59bce5 commit c0e7fc8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ script:
py.test test/
else
coverage run -m py.test test/
coverage combine
coverage report
fi
fi
21 changes: 13 additions & 8 deletions hyper/http20/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,19 @@ def receive_data(self, event):
# Append the data to the buffer.
self.data.append(event.data)

stream_about_to_close = (event.stream_ended is not None)

if increment and not self.remote_closed and not stream_about_to_close:
with self._conn as conn:
conn.increment_flow_control_window(
increment, stream_id=self.stream_id
)
self._send_outstanding_data()
if increment:
try:
with self._conn as conn:
conn.increment_flow_control_window(
increment, stream_id=self.stream_id
)
except h2.exceptions.StreamClosedError:
# We haven't got to it yet, but the stream is already
# closed. We don't need to increment the window in this
# case!
pass
else:
self._send_outstanding_data()

def receive_end_stream(self, event):
"""
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ envlist = py27, py34, py35, pypy, lint
deps= -r{toxinidir}/test_requirements.txt
commands=
coverage run -m py.test {toxinidir}/test/
coverage combine
coverage report

[testenv:pypy]
Expand Down

0 comments on commit c0e7fc8

Please sign in to comment.