From 6ffa11a744f788f1a1d00ffc1fbc1ee95fd3ff16 Mon Sep 17 00:00:00 2001 From: doronz88 Date: Sun, 23 Jun 2024 20:12:23 +0300 Subject: [PATCH] tunneld: gracefully handle StreamError --- pymobiledevice3/tunneld.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pymobiledevice3/tunneld.py b/pymobiledevice3/tunneld.py index be85926e3..87e6cd9a4 100644 --- a/pymobiledevice3/tunneld.py +++ b/pymobiledevice3/tunneld.py @@ -12,6 +12,7 @@ import fastapi import requests import uvicorn +from construct import StreamError from fastapi import FastAPI from packaging.version import Version @@ -212,8 +213,8 @@ async def start_tunnel_task( f'since there is already an active one for same udid') except asyncio.CancelledError: pass - except ConnectionResetError: - logger.debug(f'got ConnectionResetError from {asyncio.current_task().get_name()}') + except (ConnectionResetError, StreamError) as e: + logger.debug(f'got {e.__class__.__name__} from {asyncio.current_task().get_name()}') except (asyncio.exceptions.IncompleteReadError, TimeoutError, OSError) as e: logger.debug(f'got {e.__class__.__name__} from tunnel --rsd {tun.address} {tun.port}') except Exception: