Dev 0.11 (#181)
* Sonar qube 6 (#174) * test class ModbusConn * Sonar qube 3 (#178) * add more unit tests * GEN3: don't crash on overwritten msg in the receive buffer * improve test coverage und reduce test delays * reduce cognitive complexity
This commit is contained in:
@@ -25,10 +25,10 @@ class ConnectionG3(AsyncStream, Talent):
|
||||
# logger.info(f'AsyncStream refs: {gc.get_referrers(self)}')
|
||||
|
||||
async def async_create_remote(self) -> None:
|
||||
pass # virtual interface
|
||||
pass # virtual interface # pragma: no cover
|
||||
|
||||
async def async_publ_mqtt(self) -> None:
|
||||
pass # virtual interface
|
||||
pass # virtual interface # pragma: no cover
|
||||
|
||||
def healthy(self) -> bool:
|
||||
logger.debug('ConnectionG3 healthy()')
|
||||
|
||||
@@ -294,6 +294,13 @@ class Talent(Message):
|
||||
result = struct.unpack_from('!lB', buf, 0)
|
||||
msg_len = result[0] # len of complete message
|
||||
id_len = result[1] # len of variable id string
|
||||
if id_len > 17:
|
||||
logger.warning(f'len of ID string must == 16 but is {id_len}')
|
||||
self.inc_counter('Invalid_Msg_Format')
|
||||
|
||||
# erase broken recv buffer
|
||||
self._recv_buffer = bytearray()
|
||||
return
|
||||
|
||||
hdr_len = 5+id_len+2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user