forked from M-Labs/artiq
1
0
Fork 0

moninj: fix read of incomplete data (#1729)

This commit is contained in:
Star Chen 2021-07-22 17:56:38 +08:00 committed by GitHub
parent ebb67eaeee
commit 30e5e06a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -82,12 +82,12 @@ class CommMonInj:
if not ty:
return
if ty == b"\x00":
payload = await self._reader.read(9)
payload = await self._reader.readexactly(9)
channel, probe, value = struct.unpack(
self.endian + "lbl", payload)
self.monitor_cb(channel, probe, value)
elif ty == b"\x01":
payload = await self._reader.read(6)
payload = await self._reader.readexactly(6)
channel, override, value = struct.unpack(
self.endian + "lbb", payload)
self.injection_status_cb(channel, override, value)