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

Commit b141afe

Browse files
committed
Prevent double-closure.
1 parent 9298d4e commit b141afe

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

hyper/http20/connection.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,7 @@ def _close_stream(self, stream_id):
343343
"""
344344
Called by a stream when it would like to be 'closed'.
345345
"""
346-
try:
347-
del self.streams[stream_id]
348-
except KeyError:
349-
# If the stream is already missing from the dict, no-one cares.
350-
pass
346+
del self.streams[stream_id]
351347

352348
def _send_cb(self, frame):
353349
"""

hyper/http20/response.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def read(self, amt=None, decode_content=True):
127127
if decode_content and self._decompressobj:
128128
data += self._decompressobj.flush()
129129

130+
if not data:
130131
self.close()
131132

132133
return data

0 commit comments

Comments
 (0)