send() should not block once connection is closed

This commit is contained in:
Andrew Godwin 2018-06-24 16:33:54 -07:00
parent bb54f41736
commit 6dcc0d52b3
2 changed files with 5 additions and 0 deletions

View File

@ -195,6 +195,10 @@ 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
if self.connections[protocol].get("disconnected", None):
return
# Let the protocol handle it
protocol.handle_reply(message) protocol.handle_reply(message)
### Utility ### Utility

View File

@ -7,6 +7,7 @@ addopts = tests/
[isort] [isort]
line_length = 120 line_length = 120
multi_line_output = 3 multi_line_output = 3
known_first_party = channels,daphne,asgiref
[flake8] [flake8]
exclude = venv/*,tox/*,docs/*,testproject/*,js_client/*,.eggs/* exclude = venv/*,tox/*,docs/*,testproject/*,js_client/*,.eggs/*