Skip to content

Commit

Permalink
fix(fr): Add a timeout for reading consecutive frames
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
peckto and rumpelsepp committed Oct 24, 2024
1 parent 5c20f5a commit 711e2ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gallia/transports/flexray_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 711e2ff

Please sign in to comment.