Fix an AttributeError in WebSocketClientConnection._on_close.

Fix an issue that was preventing this issue from showing up in my
tests.

Closes #1140.
This commit is contained in:
Ben Darnell 2014-08-09 14:09:22 -04:00
parent 87fa80c9eb
commit 5a7719e0e9
1 changed files with 6 additions and 1 deletions

View 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)