]> 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>
Sat, 9 Aug 2014 18:09:22 +0000 (14:09 -0400)
Fix an issue that was preventing this issue from showing up in my
tests.

Closes #1140.

tornado/websocket.py

index a9cfbce21fef28765f4410c7100489522744a7cf..25c514f0f8247dd576ff567c3451a632c12b3978 100644 (file)
@@ -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)