From 2026dba3b33035d9c920e963a48867e6965adad3 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 9 Aug 2014 14:09:22 -0400 Subject: [PATCH] Fix an AttributeError in WebSocketClientConnection._on_close. Fix an issue that was preventing this issue from showing up in my tests. Closes #1140. --- tornado/websocket.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tornado/websocket.py b/tornado/websocket.py index a9cfbce21..25c514f0f 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -898,7 +898,7 @@ class WebSocketClientConnection(simple_httpclient._HTTPConnection): if not self.connect_future.done(): self.connect_future.set_exception(StreamClosedError()) self.on_message(None) - self.resolver.close() + self.tcp_client.close() super(WebSocketClientConnection, self)._on_close() def _on_http_response(self, response): @@ -927,6 +927,11 @@ class WebSocketClientConnection(simple_httpclient._HTTPConnection): self.stream = self.connection.detach() self.stream.set_close_callback(self._on_close) + # Once we've taken over the connection, clear the final callback + # we set on the http request. This deactivates the error handling + # in simple_httpclient that would otherwise interfere with our + # ability to see exceptions. + self.final_callback = None self.connect_future.set_result(self) -- 2.47.2