Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix doip #450

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/gallia/services/uds/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ async def request_unsafe(
and resp.response_code
== UDSErrorCodes.requestCorrectlyReceivedResponsePending
):
logger.info(f"Received ResponsePending: {n_pending}/{MAX_N_PENDING}")
logger.info(
f"Received ResponsePending: {n_pending}/{MAX_N_PENDING}; "
+ f"waiting for next message: {n_timeout}/{int(max_n_timeout)}s"
)
try:
raw_resp = await self._read(timeout=waiting_time, tags=config.tags)
if raw_resp == b"":
Expand All @@ -123,10 +126,6 @@ async def request_unsafe(
# Send a tester present to indicate that
# we are still there.
await self._tester_present(suppress_resp=True)
logger.debug(
"Waiting for next message after ResponsePending: "
f"{n_timeout}/{max_n_timeout}"
)
n_timeout += 1
if n_timeout >= max_n_timeout:
last_exception = MissingResponse(request, str(e))
Expand Down
9 changes: 5 additions & 4 deletions src/gallia/transports/doip.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ async def read_diag_request_raw(self) -> DoIPDiagFrame:
or payload.TargetAddress != self.src_addr
):
logger.warning(
f"DoIP-DiagnosticMessage: unexpected addresses (src:dst); expected {self.src_addr}:{self.target_addr} but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}"
f"DoIP-DiagnosticMessage: unexpected addresses (src:dst); expected {self.src_addr:#04x}:"
+ f"{self.target_addr:#04x} but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}"
)
unexpected_packets.append((hdr, payload))
continue
Expand Down Expand Up @@ -442,7 +443,8 @@ async def _read_ack(self, prev_data: bytes) -> None:
or payload.TargetAddress != self.src_addr
):
logger.warning(
f"DoIP-ACK: unexpected addresses (src:dst); expected {self.src_addr}:{self.target_addr} but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}"
f"DoIP-ACK: unexpected addresses (src:dst); expected {self.src_addr:#04x}:{self.target_addr:#04x} "
+ f"but got: {payload.SourceAddress:#04x}:{payload.TargetAddress:#04x}"
)
unexpected_packets.append((hdr, payload))
continue
Expand Down Expand Up @@ -676,8 +678,7 @@ async def write(
raise e
# TargetUnreachable can be just a temporary issue. Thus, we do not raise
# BrokenPipeError but instead ignore it here and let upper layers handle
# missing responses (i.e. raise a TimeoutError instead)
# missing responses
logger.debug("DoIP message was ACKed with TargetUnreachable")
raise asyncio.TimeoutError from e

return len(data)
Loading