mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-10 18:24:27 +05:00
added check for success of PubSubClient::beginPublish()
This commit is contained in:
@@ -70,7 +70,14 @@ public:
|
||||
doc[FPSTR(HA_DEVICE)][FPSTR(HA_CONF_URL)] = deviceConfigUrl;
|
||||
}
|
||||
|
||||
client->beginPublish(topic, measureJson(doc), true);
|
||||
if (!client->beginPublish(topic, measureJson(doc), true)) {
|
||||
if (this->yieldCallback != nullptr) {
|
||||
this->yieldCallback(yieldArg);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->bClient != nullptr) {
|
||||
serializeJson(doc, *this->bClient);
|
||||
this->bClient->flush();
|
||||
@@ -78,7 +85,7 @@ public:
|
||||
} else {
|
||||
serializeJson(doc, *client);
|
||||
}
|
||||
|
||||
|
||||
int pubResult = client->endPublish();
|
||||
if (this->yieldCallback != nullptr) {
|
||||
this->yieldCallback(yieldArg);
|
||||
|
||||
Reference in New Issue
Block a user