eclipse-paho / paho.mqtt.embedded-c

Paho MQTT C client library for embedded systems. Paho is an Eclipse IoT project (https://iot.eclipse.org/)
https://eclipse.org/paho
Other
1.37k stars 757 forks source link

Unsubscribe closes client session #176

Closed wdenlinger closed 5 years ago

wdenlinger commented 5 years ago

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?

wdenlinger commented 5 years ago

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