signalling/server: python 3.8 asyncio has it's own TimeoutError
authorMatthew Waters <matthew@centricular.com>
Fri, 1 May 2020 08:58:30 +0000 (18:58 +1000)
committerMatthew Waters <ystreet00@gmail.com>
Wed, 6 May 2020 06:01:57 +0000 (06:01 +0000)
webrtc/signalling/simple_server.py

index ead3034..7da614b 100755 (executable)
@@ -15,8 +15,7 @@ import asyncio
 import websockets
 import argparse
 import http
-
-from concurrent.futures._base import TimeoutError
+import concurrent
 
 class WebRTCSimpleServer(object):
 
@@ -58,7 +57,7 @@ class WebRTCSimpleServer(object):
         while msg is None:
             try:
                 msg = await asyncio.wait_for(ws.recv(), self.keepalive_timeout)
-            except TimeoutError:
+            except (asyncio.exceptions.TimeoutError, concurrent.futures._base.TimeoutError):
                 print('Sending keepalive ping to {!r} in recv'.format(raddr))
                 await ws.ping()
         return msg