jiejieTop / mqttclient

A high-performance, high-stability, cross-platform MQTT client, developed based on the socket API, can be used on embedded devices (FreeRTOS / LiteOS / RT-Thread / TencentOS tiny), Linux, Windows, Mac, with a very concise The API interface realizes the quality of service of QOS2 with very few resources, and seamlessly connects the mbedtls encryption library.
Apache License 2.0
694 stars 255 forks source link

关于调用mqtt_release出现fail的问题 #58

Closed Yangyuanxin closed 2 years ago

Yangyuanxin commented 2 years ago

杰神,我在写测试用例的时候需要在最终程序退出时调用mqtt_release来释放已经分配的内存,当我调用这句话的时候,走到了这个分支里:

    /* wait for the clean session to complete */
    while ((CLIENT_STATE_INVALID != mqtt_get_client_state(c))) {
        // platform_timer_usleep(1000);            // 1ms avoid compiler optimization.
        if (platform_timer_is_expired(&timer)) {
            MQTT_LOG_E("%s:%d %s()... mqtt release failed...", __FILE__, __LINE__, __FUNCTION__);
            RETURN_ERROR(MQTT_FAILED_ERROR)
        }    
    }

这也就意味着我的测试用例在之前调用mqtt_lease等接口所申请的内存并没有被释放。我在你提供的example样例里没有看到有关于它的使用方法,这里如果正确使用的话该怎么调用它才能成功呢?

frank010180 commented 3 months ago

我也有同樣的問題 是否有解 未能清除session 也無法釋放client的內容 導致我無法重新連線