Skip to content

Commit

Permalink
use Future.set_result() instead
Browse files Browse the repository at this point in the history
  • Loading branch information
qcha0 authored Aug 20, 2020
1 parent 4d5051a commit 7b9e804
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tornado/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,12 +1435,12 @@ def close(self, code: Optional[int] = None, reason: Optional[str] = None) -> Non
self.protocol = None # type: ignore

def on_connection_close(self) -> None:
if self.connect_future and not self.connect_future.done():
if not self.connect_future.done():
self.connect_future.set_exception(StreamClosedError())
self._on_message(None)
self.tcp_client.close()
self.connect_future.set_result(None)
super(WebSocketClientConnection, self).on_connection_close()
self.connect_future = None

def on_ws_connection_close(
self, close_code: Optional[int] = None, close_reason: Optional[str] = None
Expand Down

0 comments on commit 7b9e804

Please sign in to comment.