Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server keep live bug #117

Open
fangaofeng opened this issue Sep 24, 2020 · 2 comments
Open

server keep live bug #117

fangaofeng opened this issue Sep 24, 2020 · 2 comments

Comments

@fangaofeng
Copy link

when there is keeplive in connack, the exception:
result = self._handle_packet(cmd, packet)
File "E:\workspace\mqtt-simulator\env\lib\site-packages\gmqtt\mqtt\handler.py", line 214, in _handle_packet
handler(cmd, packet)
File "E:\workspace\mqtt-simulator\env\lib\site-packages\gmqtt\mqtt\handler.py", line 286, in _handle_connack_packet
File "E:\workspace\mqtt-simulator\env\lib\site-packages\gmqtt\mqtt\handler.py", line 257, in _update_keepalive_if_needed
self._connection.keepalive = self._keepalive
File "E:\workspace\mqtt-simulator\env\lib\site-packages\gmqtt\mqtt\connection.py", line 109, in keepalive
self._keep_connection_callback = asyncio.get_event_loop().call_later(self._keepalive / 2, self._keep_connection)
TypeError: unsupported operand type(s) for /: 'list' and 'int'

    def _parse_properties(self, packet):
        if self.protocol_version < MQTTv50:
            # If protocol is version is less than 5.0, there is no properties in packet
            return {}, packet
        properties_len, left_packet = unpack_variable_byte_integer(packet)
        packet = left_packet[:properties_len]
        left_packet = left_packet[properties_len:]
        properties_dict = defaultdict(list)
        while packet:
            property_identifier, = struct.unpack("!B", packet[:1])
            property_obj = Property.factory(id_=property_identifier)
            if property_obj is None:
                logger.critical('[PROPERTIES] received invalid property id {}, disconnecting'.format(property_identifier))
                return None, None
            result, packet = property_obj.loads(packet[1:])
            for k, v in result.items():
                properties_dict[k].append(v)   # this is list ,but need int
        properties_dict = dict(properties_dict)
        return properties_dict, left_packet
@Mixser
Copy link
Contributor

Mixser commented Oct 5, 2020

Hi @fangaofeng, please tell us more about your setup:

  1. Python Version
  2. Which broker do you use (and its version too)

@nicoCalvo
Copy link

+1 I'm facing the same issue. Broker mosquitto 2.x - python 3.8 or 3.9 both failing, It seems that on version 2 the server keepalive is sent and for previous versions it wasn't.
I can only reproduce it with mosquitto 2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants