eclipse / paho.mqtt.embedded-c

Paho MQTT C client library for embedded systems. Paho is an Eclipse IoT project (https://iot.eclipse.org/)

Home Page:https://eclipse.org/paho

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsubscribe closes client session

wdenlinger opened this issue · comments

Whenever I unsubscribe from a topic, the client session is marked as disconnected.

After sending an UNSUBSCRIBE packet, I receive an UNSUBACK from the server. In the function cycle() (MQTTClient.c), readPacket() returns the packet type 11 (UNSUBACK). Since there is no defined case for UNSUBACK in the switch statement, the default path is taken. This sets the rc to the packet_type then jumps to the exit label. Since rc != SUCCESS, and the client is connected, the session is closed.

Is this expected behavior, or should there be a case statement for UNSUBACK that simply breaks?

Never mind. I see this is fixed in the master branch