diff --git a/daphne/server.py b/daphne/server.py index 6a65ebb..d8d43f2 100755 --- a/daphne/server.py +++ b/daphne/server.py @@ -195,6 +195,10 @@ class Server(object): """ Coroutine that jumps the reply message from asyncio to Twisted """ + # Don't do anything if the connection is closed + if self.connections[protocol].get("disconnected", None): + return + # Let the protocol handle it protocol.handle_reply(message) ### Utility diff --git a/setup.cfg b/setup.cfg index 4223ddf..8c9a5f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,6 +7,7 @@ addopts = tests/ [isort] line_length = 120 multi_line_output = 3 +known_first_party = channels,daphne,asgiref [flake8] exclude = venv/*,tox/*,docs/*,testproject/*,js_client/*,.eggs/*