flash_can: add retries to verification

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-04-25 17:17:19 -04:00
parent f754ae2746
commit f0d7bb7f9c
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A

View File

@ -158,11 +158,16 @@ class CanFlasher:
if resp == i:
# command should ack with the requested block as
# parameter
buf = await self.node.readexactly(
self.block_size, timeout=10.
)
if len(buf) == self.block_size:
break
try:
buf = await self.node.readexactly(
self.block_size, timeout=5.
)
except asyncio.TimeoutError:
if tries:
output_line("\nRead Timeout, Retrying...")
else:
if len(buf) == self.block_size:
break
tries -= 1
await asyncio.sleep(.1)
else: