tuanpmt / esp_mqtt

MQTT client library for ESP8266
http://tuanpm.net/post/esp_mqtt/
MIT License
1.14k stars 400 forks source link

mqtt_start_receive_schedule will loop forever if read_len < 0; #144

Open shenfumin opened 7 years ago

shenfumin commented 7 years ago

in the function mqtt_start_receive_schedule, if read_len < 0, it will loop forever and not jump out the loop. while (1) {

    read_len = ClientRead(client->mqtt_state.in_buffer, CONFIG_MQTT_BUFFER_SIZE_BYTE);
    mqtt_info("Read len %d", read_len);
    if (read_len == 0)
        break;
    .......

} how to fix it? i had tried the following change if (read_len <= 0) break; it could work normally. but i am not sure. anyboady found this issue or have some idea?