]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix an AttributeError in WebSocketClientConnection._on_close.
authorBen Darnell <ben@bendarnell.com>
Sat, 9 Aug 2014 18:09:22 +0000 (14:09 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 10 Aug 2014 18:13:25 +0000 (14:13 -0400)
Fix an issue that was preventing this issue from showing up in my
tests.

Closes #1140.

tornado/websocket.py

index a77e02c49357754c9ab8328b23ba605f3adacc69..bc1a76660b6a0e81533276142e3d2050bf03ff16 100644 (file)
@@ -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)