wialon / gmqtt

Python MQTT v5.0 async client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error occurs when QoS is set to 2

jeffreykira opened this issue · comments

I have two mqtt clients.
When the QoS of publish and subscribe is set to 2 at the same time, I get the following error.

[ERROR HANDLE PKG]
Traceback (most recent call last):
  File "/Users/jing/virtualenv/mqtt_test/lib/python3.8/site-packages/gmqtt/mqtt/handler.py", line 351, in __call__
    result = self._handle_packet(cmd, packet)
  File "/Users/jing/virtualenv/mqtt_test/lib/python3.8/site-packages/gmqtt/mqtt/handler.py", line 204, in _handle_packet
    handler(cmd, packet)
  File "/Users/jing/virtualenv/mqtt_test/lib/python3.8/site-packages/gmqtt/mqtt/handler.py", line 403, in _handle_pubrel_packet
    mid, = struct.unpack("!H", packet)
struct.error: unpack requires a buffer of 2 bytes

Why does this error occur?

@jeffreykira thanks, fixed in version 0.5.1

@Lenka42 I confirm it works. Thanks!