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.0.1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a7719e0e9e3c682e06870859ee11cae51d8f9ca;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 a77e02c49..bc1a76660 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -703,7 +703,7 @@ class WebSocketClientConnection(simple_httpclient._HTTPConnection): def _on_close(self): self.on_message(None) - self.resolver.close() + self.tcp_client.close() super(WebSocketClientConnection, self)._on_close() def _on_http_response(self, response): @@ -734,6 +734,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)