File tree Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -199,21 +199,25 @@ async def _handle_websocket(
199199 url = f"{ url } ?{ request .query_string } "
200200
201201 # Start proxy
202- async with self .sys_websession .ws_connect (
203- url ,
204- headers = source_header ,
205- protocols = req_protocols ,
206- autoclose = False ,
207- autoping = False ,
208- ) as ws_client :
209- # Proxy requests
210- await asyncio .wait (
211- [
212- self .sys_create_task (_websocket_forward (ws_server , ws_client )),
213- self .sys_create_task (_websocket_forward (ws_client , ws_server )),
214- ],
215- return_when = asyncio .FIRST_COMPLETED ,
216- )
202+ try :
203+ _LOGGER .debug ("Proxing WebSocket to %s, upstream url: %s" , addon .slug , url )
204+ async with self .sys_websession .ws_connect (
205+ url ,
206+ headers = source_header ,
207+ protocols = req_protocols ,
208+ autoclose = False ,
209+ autoping = False ,
210+ ) as ws_client :
211+ # Proxy requests
212+ await asyncio .wait (
213+ [
214+ self .sys_create_task (_websocket_forward (ws_server , ws_client )),
215+ self .sys_create_task (_websocket_forward (ws_client , ws_server )),
216+ ],
217+ return_when = asyncio .FIRST_COMPLETED ,
218+ )
219+ except TimeoutError :
220+ _LOGGER .warning ("WebSocket proxy to %s timed out" , addon .slug )
217221
218222 return ws_server
219223
You can’t perform that action at this time.
0 commit comments