Skip to content

Commit

Permalink
Handle timeout in aread_response
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Kryński committed Mar 13, 2023
1 parent 95daae2 commit 537f717
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions canopen/sdo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ def read_response(self):

async def aread_response(self):
try:
response = await self.aresponses.get()
except queue.Empty:
response = await asyncio.wait_for(
self.aresponses.get(), timeout=self.RESPONSE_TIMEOUT)
except TimeoutError:
raise SdoCommunicationError("No SDO response received")
res_command, = struct.unpack_from("B", response)
if res_command == RESPONSE_ABORTED:
Expand Down

0 comments on commit 537f717

Please sign in to comment.