Skip to content

Commit

Permalink
Free message if request queue is full
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Jul 4, 2019
1 parent 26f8f02 commit 5c8d04b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sming/Core/Network/MqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ bool MqttClient::connect(const Url& url, const String& clientName, uint32_t sslO
}
}

if(requestQueue.full()) {
debug_e("MQTT request queue full!");
return false;
}

mqtt_message_t* message = (mqtt_message_t*)malloc(sizeof(mqtt_message_t));
memcpy(message, &connectMessage, sizeof(mqtt_message_t));
requestQueue.enqueue(message);
Expand Down

0 comments on commit 5c8d04b

Please sign in to comment.