Skip to content

Commit

Permalink
Use transport.is_closing
Browse files Browse the repository at this point in the history
  • Loading branch information
invisibleroads committed May 6, 2024
1 parent 4d23d9b commit 629bd7e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions uvicorn/protocols/websockets/websockets_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,8 @@ def send_500_response(self) -> None:
b"\r\n",
msg,
]
try:
if not self.transport.is_closing():
self.transport.write(b"".join(content))
except RuntimeError:
pass
# Allow handler task to terminate cleanly, as websockets doesn't cancel it by
# itself (see https://github.com/encode/uvicorn/issues/920)
self.handshake_started_event.set()
Expand Down

0 comments on commit 629bd7e

Please sign in to comment.