fix: retry when raise ConnectionRefusedError

with_status
WorldObservationLog 4 months ago
parent 34dbeb27bc
commit e493a5290b
  1. 5
      src/decrypt.py

@ -18,7 +18,12 @@ retry_count = {}
async def decrypt(info: SongInfo, keys: list[str], manifest: Datum, device: Device) -> bytes: async def decrypt(info: SongInfo, keys: list[str], manifest: Datum, device: Device) -> bytes:
async with device.decryptLock: async with device.decryptLock:
logger.info(f"Decrypting song: {manifest.attributes.artistName} - {manifest.attributes.name}") logger.info(f"Decrypting song: {manifest.attributes.artistName} - {manifest.attributes.name}")
try:
reader, writer = await asyncio.open_connection(device.host, device.fridaPort) reader, writer = await asyncio.open_connection(device.host, device.fridaPort)
except ConnectionRefusedError:
logger.warning(f"Failed to connect to device {device.device.serial}, re-injecting")
device.restart_inject_frida()
raise RetryableDecryptException
decrypted = bytes() decrypted = bytes()
last_index = 255 last_index = 255
for sample in info.samples: for sample in info.samples:

Loading…
Cancel
Save