Skip to content

Commit

Permalink
Remove conditional on RemoteProtocolError.event_hint (#1486)
Browse files Browse the repository at this point in the history
* Add code on events.CloseConnection for wsproto

* Update uvicorn/protocols/websockets/wsproto_impl.py

Co-authored-by: Tom Christie <tom@tomchristie.com>

* RemoteProtocolError always have an event_hint

Co-authored-by: Tom Christie <tom@tomchristie.com>
  • Loading branch information
Kludex and tomchristie committed Oct 31, 2022
1 parent 26cace2 commit 697588d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions uvicorn/protocols/websockets/wsproto_impl.py
Expand Up @@ -87,11 +87,8 @@ def data_received(self, data):
try:
self.conn.receive_data(data)
except RemoteProtocolError as err:
if err.event_hint is not None:
self.transport.write(self.conn.send(err.event_hint))
self.transport.close()
else:
self.handle_no_connect(events.CloseConnection())
self.transport.write(self.conn.send(err.event_hint))
self.transport.close()
else:
self.handle_events()

Expand Down

0 comments on commit 697588d

Please sign in to comment.