mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
merge mqtt changes from bertmelis, dev2
This commit is contained in:
@@ -131,10 +131,9 @@ class MqttClient {
|
|||||||
uint32_t timeSent;
|
uint32_t timeSent;
|
||||||
espMqttClientInternals::Packet packet;
|
espMqttClientInternals::Packet packet;
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
OutgoingPacket(uint32_t t, espMqttClientTypes::Error & error, Args &&... args)
|
OutgoingPacket(uint32_t t, espMqttClientTypes::Error& error, Args&&... args) : // NOLINT(runtime/references)
|
||||||
: timeSent(t)
|
timeSent(t),
|
||||||
, packet(error, std::forward<Args>(args)...) {
|
packet(error, std::forward<Args>(args)...) {}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
espMqttClientInternals::Outbox<OutgoingPacket> _outbox;
|
espMqttClientInternals::Outbox<OutgoingPacket> _outbox;
|
||||||
size_t _bytesSent;
|
size_t _bytesSent;
|
||||||
@@ -150,19 +149,27 @@ class MqttClient {
|
|||||||
bool _addPacket(Args &&... args) {
|
bool _addPacket(Args &&... args) {
|
||||||
espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS);
|
espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS);
|
||||||
espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.emplace(0, error, std::forward<Args>(args)...);
|
espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.emplace(0, error, std::forward<Args>(args)...);
|
||||||
if (it && error == espMqttClientTypes::Error::SUCCESS)
|
if (it && error == espMqttClientTypes::Error::SUCCESS) {
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
if (it)
|
||||||
|
_outbox.remove(it);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
bool _addPacketFront(Args &&... args) {
|
bool _addPacketFront(Args &&... args) {
|
||||||
espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS);
|
espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS);
|
||||||
espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.emplaceFront(0, error, std::forward<Args>(args)...);
|
espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.emplaceFront(0, error, std::forward<Args>(args)...);
|
||||||
if (it && error == espMqttClientTypes::Error::SUCCESS)
|
if (it && error == espMqttClientTypes::Error::SUCCESS) {
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
if (it)
|
||||||
|
_outbox.remove(it);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _checkOutbox();
|
void _checkOutbox();
|
||||||
int _sendPacket();
|
int _sendPacket();
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "3.7.0-dev.1d"
|
#define EMSESP_APP_VERSION "3.7.0-dev.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user