From: Ben Darnell Date: Sat, 9 Aug 2014 18:09:22 +0000 (-0400) Subject: Fix an AttributeError in WebSocketClientConnection._on_close. X-Git-Tag: v4.1.0b1~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2026dba3b33035d9c920e963a48867e6965adad3;p=thirdparty%2Ftornado.git Fix an AttributeError in WebSocketClientConnection._on_close. Fix an issue that was preventing this issue from showing up in my tests. Closes #1140. --- 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)