From 74f709a59fbd2e564db19eba7ab0717149c2875c Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 11 Apr 2023 21:05:07 -0700 Subject: [PATCH] IsoTpParallelQuery: break earlier and add comment (#27883) * better ordering and comments * one comment one dream --- selfdrive/car/isotp_parallel_query.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/isotp_parallel_query.py b/selfdrive/car/isotp_parallel_query.py index 2e8a210c64..84ddde360d 100644 --- a/selfdrive/car/isotp_parallel_query.py +++ b/selfdrive/car/isotp_parallel_query.py @@ -100,9 +100,6 @@ class IsoTpParallelQuery: while True: self.rx() - if all(request_done.values()): - break - for tx_addr, msg in msgs.items(): try: dat, rx_in_progress = msg.recv() @@ -140,6 +137,10 @@ class IsoTpParallelQuery: 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 + cur_time = time.monotonic() if cur_time - max(response_timeouts.values()) > 0: for tx_addr in msgs: