Skip to content

Commit

Permalink
fix cleanup
Browse files Browse the repository at this point in the history
fixes #226
  • Loading branch information
bertmelis authored Feb 11, 2021
1 parent b649b2e commit 2635abd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/AsyncMqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ void AsyncMqttClient::_handleQueue() {
#else
while (_sendHead && _client->space() > 10) { // send at least 10 bytes
#endif
log_i("space: %u", _client->space());
// Try to send first
if (_sendHead->size() > _sent) {
#if ASYNC_TCP_SSL_ENABLED
Expand All @@ -436,7 +435,7 @@ void AsyncMqttClient::_handleQueue() {
}

// Delete obsolete packets
while (_firstPacket && _firstPacket->released() && _acked == _firstPacket->size()) {
while (_firstPacket && _firstPacket->released() && _acked >= _firstPacket->size()) {
log_i("rmv #%u", _firstPacket->packetType());
AsyncMqttClientInternals::OutPacket* next = _firstPacket->getNext();
_acked -= _firstPacket->size();
Expand All @@ -453,7 +452,7 @@ void AsyncMqttClient::_handleQueue() {
}

// Stop processing when we have to wait for an MQTT acknowledgment
if (_sendHead && _sendHead->size() <= _sent) {
if (_sendHead && _sendHead->size() == _sent) {
if (_sendHead->released()) {
log_i("p #%d rel", _sendHead->packetType());
_sendHead = _sendHead->getNext();
Expand Down

0 comments on commit 2635abd

Please sign in to comment.