diff --git a/pymobiledevice3/tunneld.py b/pymobiledevice3/tunneld.py index 42ab34a7f..1f57357e2 100644 --- a/pymobiledevice3/tunneld.py +++ b/pymobiledevice3/tunneld.py @@ -11,6 +11,7 @@ import uvicorn from fastapi import FastAPI from ifaddr import get_adapters +from packaging.version import Version from pymobiledevice3.remote.bonjour import query_bonjour from pymobiledevice3.remote.common import TunnelProtocol @@ -21,10 +22,6 @@ logger = logging.getLogger(__name__) -ZEROCONF_TIMEOUT = 3000 -MIN_VERSION = '17.0.0' -UNINIT_ADDRESS = ('', 0) - @dataclasses.dataclass class TunnelTask: @@ -83,7 +80,7 @@ async def handle_new_ip(self, ip: str): # validate a CoreDevice was indeed found addresses = query.listener.addresses if not addresses: - return + raise asyncio.CancelledError() peer_address = addresses[0] # establish an untrusted RSD handshake @@ -92,7 +89,10 @@ async def handle_new_ip(self, ip: str): try: rsd.connect() except ConnectionRefusedError: - return + raise asyncio.CancelledError() + + if (self.protocol == TunnelProtocol.QUIC) and (Version(rsd.product_version) < Version('17.0.0')): + raise asyncio.CancelledError() # populate the udid from the untrusted RSD information self.tunnel_tasks[ip].udid = rsd.udid