Don't try to send disconnect when we never made an app instance

This commit is contained in:
Andrew Godwin 2018-05-03 09:47:12 -07:00 committed by Andrew Godwin
parent 097f3ba8e8
commit dd2c8b2a0f

View File

@ -142,7 +142,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
""" """
self.server.protocol_disconnected(self) self.server.protocol_disconnected(self)
logger.debug("WebSocket closed for %s", self.client_addr) logger.debug("WebSocket closed for %s", self.client_addr)
if not self.muted: if not self.muted and hasattr(self, "application_queue"):
self.application_queue.put_nowait({ self.application_queue.put_nowait({
"type": "websocket.disconnect", "type": "websocket.disconnect",
"code": code, "code": code,