Skip to content

Commit e344a37

Browse files
committed
Don't ack within 'read' if we are having a callback registered and reading from within the callback
1 parent e74cc1a commit e344a37

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/MqttClient.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,9 @@ int MqttClient::read(uint8_t *buf, size_t size)
713713
_rxLength -= result;
714714

715715
if (_rxLength == 0) {
716-
ackRxMessage();
716+
if (!_onMessage) {
717+
ackRxMessage();
718+
}
717719

718720
_rxState = MQTT_CLIENT_RX_STATE_READ_TYPE;
719721
}

0 commit comments

Comments
 (0)