Skip to content

Commit

Permalink
Fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
hieucdtspk committed Jan 21, 2018
1 parent a36560f commit c0592ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ESP8266MQTTClient.cpp
Expand Up @@ -372,14 +372,20 @@ int MQTTClient::processRead()
uint8_t msg_qos;
uint16_t msg_id;
mqtt_outbox *valid_msg;

PROCESS_READ_AGAIN: // fix #6
if(!connected())
return 0;
_tcp->setTimeout(DEFAULT_MQTT_READ_TIMEOUT);
read_len = _transportTraits->read(_tcp.get(), _state.in_buffer, DEFAULT_MQTT_BUFFER_SIZE_BYTES);
if(read_len <= 0)
return 0;
_state.message_length_read = read_len;
PROCESS_READ_AGAIN:

// Issue #6: place this retry label here may lead to non-stop retry loop and cause wdt reset
// if current msg_type != MQTT_MSG_TYPE_SUBACK (i.e. MQTT_MSG_TYPE_PINGRESP)
// PROCESS_READ_AGAIN:

msg_type = mqtt_get_type(_state.in_buffer);
msg_qos = mqtt_get_qos(_state.in_buffer);
msg_id = mqtt_get_id(_state.in_buffer, _state.in_buffer_length);
Expand Down

0 comments on commit c0592ee

Please sign in to comment.