Skip to content

Commit

Permalink
Fixes websockets implementation where handshake fails left tasks pend…
Browse files Browse the repository at this point in the history
…ing (#921)

* Set handshake_started_event

* Added comment
  • Loading branch information
euri10 committed Dec 29, 2020
1 parent 70ec20f commit 091571b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions uvicorn/protocols/websockets/websockets_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ def send_500_response(self):
msg,
]
self.transport.write(b"".join(content))
# 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()

async def ws_handler(self, protocol, path):
"""
Expand Down

0 comments on commit 091571b

Please sign in to comment.