Skip to content

Commit

Permalink
Merge pull request #688 from doronz88/bugfix/lockdown-reconnect
Browse files Browse the repository at this point in the history
lockdown: fix reconnect
  • Loading branch information
doronz88 authored Nov 23, 2023
2 parents 462a653 + 99b33c2 commit dd3baf7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymobiledevice3/lockdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ def _inner_reconnect_on_remote_close(*args, **kwargs):
try:
return f(*args, **kwargs)
except (BrokenPipeError, ConnectionTerminatedError):
self = args[0]
self: LockdownClient = args[0]

# first we release the socket on our end to avoid a ResourceWarning
self.close()

# now we re-establish the connection
self.logger.debug('remote device closed the connection. reconnecting...')
self.afc = self._create_service_connection(self.port)
self.service = self._create_service_connection(self.port)
self.validate_pairing()
return f(*args, **kwargs)

Expand Down

0 comments on commit dd3baf7

Please sign in to comment.