Skip to content

Commit 70680d6

Browse files
author
Thomas Salm
committed
to version 1.6.2
1 parent 5485743 commit 70680d6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "saic_ismart_client"
7-
version = "1.6.1"
7+
version = "1.6.2"
88
authors = [
99
{ name = "Thomas Salm", email="[email protected]"},
1010
]

src/saic_ismart_client/common_model.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,15 @@ def decode_response(self, message: str, decoded_message: MessageV2) -> None:
477477
dispatcher_message_size = header.dispatcher_message_length - self.header_length
478478
LOG.debug(f'Dispatcher message bytes: {dispatcher_message_size}')
479479

480-
if int(netto_message_size) == dispatcher_message_size:
480+
# The API sometimes provides a wrong dispatcher_message_length value
481+
# Normally the body size is about 120 bytes
482+
# A value below 50 is very unlikely.
483+
if dispatcher_message_size > 50:
481484
dispatcher_message_bytes_to_read = dispatcher_message_size
482485
else:
483486
LOG.debug(f'Calculated message size {int(netto_message_size)} does not match '
484487
+ f'with header size information {dispatcher_message_size}. Using calculated size.')
488+
# This will fail if the message contains application data. In this case we cannot tell the body size
485489
dispatcher_message_bytes_to_read = int(netto_message_size)
486490

487491
dispatcher_message_bytes = buffered_message_bytes.read(dispatcher_message_bytes_to_read)

0 commit comments

Comments
 (0)