Problem: abruptly closed sockets still in memory (#2408)

Solution: Catch the proper exception and remove socket from memory.
This commit is contained in:
vrde 2018-07-26 15:29:53 +02:00 committed by Shahbaz Nazir
parent 0c33b4c211
commit 2087f7090f

View File

@ -16,6 +16,7 @@ import asyncio
import logging
import threading
from uuid import uuid4
from concurrent.futures import CancelledError
import aiohttp
from aiohttp import web
@ -125,6 +126,9 @@ def websocket_handler(request):
except RuntimeError as e:
logger.debug('Websocket exception: %s', str(e))
break
except CancelledError as e:
logger.debug('Websocket closed')
break
if msg.type == aiohttp.WSMsgType.CLOSED:
logger.debug('Websocket closed')
break