This fixes the following exception I was seeing in my logs:

Nov 27 13:20:47 python3[28665]: File "/var/lib/wwwrun/.virtualenvs//lib/python3.6/site-packages/channels/consumer.py", line 81, in send
Nov 27 13:20:47 python3[28665]: await self.base_send(message)
Nov 27 13:20:47 python3[28665]: File "/var/lib/wwwrun/.virtualenvs//lib/python3.6/site-packages/channels/sessions.py", line 232, in send
Nov 27 13:20:47 python3[28665]: return await self.real_send(message)
Nov 27 13:20:47 python3[28665]: File "/var/lib/wwwrun/.virtualenvs//lib/python3.6/site-packages/daphne/server.py", line 213, in handle_reply
Nov 27 13:20:47 python3[28665]: if self.connections[protocol].get("disconnected", None):
Nov 27 13:20:47 python3[28665]: KeyError: <WebSocketProtocol client=None path=b'/vnc/devices/'>
This commit is contained in:
Kyle Agronick 2018-11-27 13:25:18 -05:00
parent 44b7115db7
commit 4d1b87ee42

View File

@ -210,7 +210,7 @@ class Server(object):
Coroutine that jumps the reply message from asyncio to Twisted Coroutine that jumps the reply message from asyncio to Twisted
""" """
# Don't do anything if the connection is closed # Don't do anything if the connection is closed
if self.connections[protocol].get("disconnected", None): if protocol not in self.connections or self.connections[protocol].get("disconnected"):
return return
self.check_headers_type(message) self.check_headers_type(message)
# Let the protocol handle it # Let the protocol handle it