Skip to content

Commit

Permalink
refactor(ECU.connect): move definition to UDSClient and call it as pa…
Browse files Browse the repository at this point in the history
…rt of UDSClient.reconnect
  • Loading branch information
emedav authored and rumpelsepp committed Aug 19, 2024
1 parent c39e783 commit 7c6b026
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/gallia/services/uds/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ def __init__(
self.pending_timeout = 5
self.mutex = asyncio.Lock()

async def connect(self) -> None: ...

async def reconnect(self, timeout: int | None = None) -> None:
"""Calls the underlying transport to trigger a reconnect"""
async with self.mutex:
self.transport = await self.transport.reconnect(timeout)

await self.connect()

async def _read(self, timeout: float | None = None, tags: list[str] | None = None) -> bytes:
if timeout is None and self.timeout:
timeout = self.timeout
Expand Down
2 changes: 0 additions & 2 deletions src/gallia/services/uds/ecu.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def __init__(
self.db_handler: DBHandler | None = None
self.implicit_logging = True

async def connect(self) -> None: ...

async def properties(
self, fresh: bool = False, config: UDSRequestConfig | None = None
) -> dict[str, Any]:
Expand Down

0 comments on commit 7c6b026

Please sign in to comment.