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

Commit 3ac4dbd

Browse files
committed
Tighten lock scope.
1 parent 11ba702 commit 3ac4dbd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

hyper/http20/stream.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,15 @@ def close(self, error_code=None):
279279
"""
280280
# FIXME: I think this is overbroad, but for now it's probably ok.
281281
if not (self.remote_closed and self.local_closed):
282-
with self._conn as conn:
283-
try:
282+
try:
283+
with self._conn as conn:
284284
conn.reset_stream(self.stream_id, error_code or 0)
285-
except h2.exceptions.ProtocolError:
286-
# If for any reason we can't reset the stream, just
287-
# tolerate it.
288-
pass
289-
else:
290-
self._send_outstanding_data(tolerate_peer_gone=True)
285+
except h2.exceptions.ProtocolError:
286+
# If for any reason we can't reset the stream, just
287+
# tolerate it.
288+
pass
289+
else:
290+
self._send_outstanding_data(tolerate_peer_gone=True)
291291
self.remote_closed = True
292292
self.local_closed = True
293293

0 commit comments

Comments
 (0)