Catch connection reset (#22982)

This commit is contained in:
Paulus Schoutsen 2019-04-10 15:42:10 -07:00 committed by GitHub
parent e9d9861bda
commit 373b2009c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,7 +53,8 @@ class WebSocketHandler:
async def _writer(self):
"""Write outgoing messages."""
# Exceptions if Socket disconnected or cancelled by connection handler
with suppress(RuntimeError, *CANCELLATION_ERRORS):
with suppress(RuntimeError, ConnectionResetError,
*CANCELLATION_ERRORS):
while not self.wsock.closed:
message = await self._to_write.get()
if message is None: