From 09df1f86b2bf02f20078d5a43e618bb2d4893dcb Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 11 Apr 2023 22:05:00 -0700 Subject: [PATCH] IsoTpParallelQuery: set timed out requests done (#27764) * better ordering and comments * remove * mark done if timed out * response_timeouts should be only for extending timeouts, not marking done * so the print still works * more clear comment * that can be removed old-commit-hash: f5519fdca8a5008e7ddcbc32d003bcf91db31bd2 --- selfdrive/car/isotp_parallel_query.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/selfdrive/car/isotp_parallel_query.py b/selfdrive/car/isotp_parallel_query.py index 84ddde360d..965d2e1836 100644 --- a/selfdrive/car/isotp_parallel_query.py +++ b/selfdrive/car/isotp_parallel_query.py @@ -133,19 +133,19 @@ class IsoTpParallelQuery: response_timeouts[tx_addr] = time.monotonic() + self.response_pending_timeout cloudlog.error(f"iso-tp query response pending: {tx_addr}") else: - response_timeouts[tx_addr] = 0 request_done[tx_addr] = True cloudlog.error(f"iso-tp query bad response: {tx_addr} - 0x{dat.hex()}") - # Break if all requests are done, we've timed out on all requests, or we've hit a max total timeout - if all(request_done.values()): - break - + # Mark request done if address timed out cur_time = time.monotonic() - if cur_time - max(response_timeouts.values()) > 0: - for tx_addr in msgs: + for tx_addr in response_timeouts: + if cur_time - response_timeouts[tx_addr] > 0: if request_counter[tx_addr] > 0 and not request_done[tx_addr]: cloudlog.error(f"iso-tp query timeout after receiving response: {tx_addr}") + request_done[tx_addr] = True + + # Break if all requests are done (finished or timed out) + if all(request_done.values()): break if cur_time - start_time > total_timeout: