From 168f3d4d55db19b9877454051dd03eda7da42202 Mon Sep 17 00:00:00 2001 From: doronz88 Date: Wed, 12 Feb 2025 08:28:46 +0200 Subject: [PATCH] lockdown: Fix handling of device disconnection during ctor over usbmux Since every lockdown protocol handler may try to reconnect to the device, we must initialize `self.usbmux_address` before triggering the ctor. This solves the issue when the device disconnects while ctor didn't finish the job. --- pymobiledevice3/lockdown.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymobiledevice3/lockdown.py b/pymobiledevice3/lockdown.py index 97ca10f88..59ccd4f58 100755 --- a/pymobiledevice3/lockdown.py +++ b/pymobiledevice3/lockdown.py @@ -619,9 +619,9 @@ def __init__(self, service: ServiceConnection, host_id: str, identifier: str = N label: str = DEFAULT_LABEL, system_buid: str = SYSTEM_BUID, pair_record: Optional[dict] = None, pairing_records_cache_folder: Path = None, port: int = SERVICE_PORT, usbmux_address: Optional[str] = None): + self.usbmux_address = usbmux_address super().__init__(service, host_id, identifier, label, system_buid, pair_record, pairing_records_cache_folder, port) - self.usbmux_address = usbmux_address @property def short_info(self) -> dict: