Skip to content

Commit

Permalink
chore(logs): Improve log messages in TesterPresent and DoIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdinandjarisch committed Oct 10, 2023
1 parent abeb6ca commit 4f958c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 2 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,8 @@ 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 +124,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
6 changes: 4 additions & 2 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

0 comments on commit 4f958c0

Please sign in to comment.