From 81d554fda3effd00f588af4b2f7d2314784eb659 Mon Sep 17 00:00:00 2001 From: Tobias Specht Date: Thu, 24 Oct 2024 09:33:19 +0200 Subject: [PATCH] fix(fr): Add a timeout for reading consecutive frames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not clear which timeout makes sense. This is a educated guess, that needs to be refined in the futureā€¦ Co-Authored-By: Stefan Tatschner --- src/gallia/transports/flexray_vector.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallia/transports/flexray_vector.py b/src/gallia/transports/flexray_vector.py index f059bea80..7a1f82984 100644 --- a/src/gallia/transports/flexray_vector.py +++ b/src/gallia/transports/flexray_vector.py @@ -448,7 +448,10 @@ async def _handle_fragmented(self, expected_len: int) -> bytes: if self._require_fc_frame(self.config.fc_block_size, read_bytes): await self._send_flow_control_frame() - frame = await self.read_tp_frame() + # TODO: Make this configurable. Maybe align with separation_time. + async with asyncio.timeout(10): + frame = await self.read_tp_frame() + if not isinstance(frame, FlexRayTPConsecutiveFrame): raise RuntimeError(f"expected consecutive frame, got: {frame}") if frame.counter != (counter & 0x0F):