Skip to content

Commit

Permalink
Merge pull request #942 from doronz88/bugfix/safe-close
Browse files Browse the repository at this point in the history
remote: fix triggering of `close()` when endpoint isn't connected
  • Loading branch information
doronz88 committed Apr 16, 2024
2 parents 3a6203c + d3a7003 commit 4da8be8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pymobiledevice3/remote/remotexpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ async def connect(self, keep_alive: bool = True) -> None:
await self._do_handshake()

async def close(self) -> None:
await self.service_connection.aio_close()
if self.service_connection is not None:
await self.service_connection.aio_close()

async def send_request(self, data: Mapping, wanting_reply: bool = False) -> None:
xpc_wrapper = create_xpc_wrapper(
Expand Down
3 changes: 2 additions & 1 deletion pymobiledevice3/remote/tunnel_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,8 @@ async def start_tcp_tunnel(self) -> AsyncGenerator['TunnelResult', None]:
await tunnel.stop_tunnel()

async def close(self) -> None:
await self._service.aio_close()
if self._service is not None:
await self._service.aio_close()


async def create_core_device_tunnel_service_using_rsd(
Expand Down

0 comments on commit 4da8be8

Please sign in to comment.