Skip to content

Commit

Permalink
simplify publish function
Browse files Browse the repository at this point in the history
  • Loading branch information
hmueller01 committed Nov 17, 2024
1 parent a6212f5 commit f0ffdd7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/MqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,10 @@ int MqttClient::endMessage()
*/
int MqttClient::publish(const char* topic, const char* payload, bool retain, uint8_t qos, bool dup) {
int ret = beginMessage(topic, strlen_P(payload), retain, qos, dup);
if (!ret) {
return ret;
if (ret) {
print(payload);
ret = endMessage();
}
print(payload);
ret = endMessage();
return ret;
}

Expand Down

0 comments on commit f0ffdd7

Please sign in to comment.