Skip to content

Commit e664747

Browse files
authored
Merge pull request #4 from mrk-its/aread_response_timeout
Handle timeout in aread_response
2 parents e6ce8f6 + 4061f71 commit e664747

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

canopen/sdo/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ def read_response(self):
109109

110110
async def aread_response(self):
111111
try:
112-
response = await self.aresponses.get()
113-
except queue.Empty:
112+
response = await asyncio.wait_for(
113+
self.aresponses.get(), timeout=self.RESPONSE_TIMEOUT)
114+
except asyncio.TimeoutError:
114115
raise SdoCommunicationError("No SDO response received")
115116
res_command, = struct.unpack_from("B", response)
116117
if res_command == RESPONSE_ABORTED:

0 commit comments

Comments
 (0)