[Bug report] aws_iot_connect and aws_iot_disconnect fail when mqtt_library is in the wrong state

In my application using aws_iot library, the call of aws_iot_connect occasionally results in the following error messages.

[00:00:41.412,811] <err> aws_iot: Timed out waiting for subscription acknowledgments
[00:00:41.412,902] <err> mqtt_helper: Library is in the wrong state (MQTT_STATE_CONNECTING), MQTT_STATE_CONNECTED required
[00:00:41.412,902] <err> aws_iot: mqtt_helper_disconnect, error: -95

The "Library is in the wrong state" error is caused by the call of aws_iot_disconnect near the end of the definition of aws_iot_connect. So aws_iot_disconnect does not work when mqtt_library is in the state MQTT_STATE_CONNECTING. If I then try to call aws_iot_connect again, I get the following error messages.

[00:01:27.932,159] <err> mqtt_helper: Library is in the wrong state (MQTT_STATE_CONNECTING), MQTT_STATE_DISCONNECTED required
[00:01:27.932,159] <err> aws_iot: mqtt_helper_connect, error: -95

So it seems that the program has reached a state in which it is not possible to recover by using either aws_iot_connect or aws_iot_disconnect. I think that the expected behavior would be for calling aws_iot_disconnect to always result in the state MQTT_STATE_DISCONNECTED. 

Parents Reply Children
No Data
Related