driver: fix incorrect recv_response behavior
This commit is contained in:
parent
3ba8b99084
commit
3d2294a90c
|
@ -835,11 +835,15 @@ class Kirdy:
|
||||||
self._connected_sig.emit(True)
|
self._connected_sig.emit(True)
|
||||||
|
|
||||||
async def _read_response(self, buffer_size=16384):
|
async def _read_response(self, buffer_size=16384):
|
||||||
raw_response = await self._reader.read(buffer_size)
|
raw_response = b''
|
||||||
|
while len(raw_response) == 0:
|
||||||
|
# Ignore 0 size packet
|
||||||
|
raw_response = await self._reader.read(buffer_size)
|
||||||
response = raw_response.decode('utf-8', errors='ignore').split("\n")
|
response = raw_response.decode('utf-8', errors='ignore').split("\n")
|
||||||
response.reverse()
|
response = response[:-1]
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
for item in response[1:]:
|
for item in response:
|
||||||
items.append(json.loads(item))
|
items.append(json.loads(item))
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue