Big rewrite of MqttClient in order to avoid code duplicate

This commit is contained in:
hsaturn
2021-04-04 05:57:48 +02:00
parent 510ff514a9
commit 297a22efb5
4 changed files with 158 additions and 68 deletions

View File

@@ -17,10 +17,15 @@ MqttBroker broker(1883);
std::map<std::string, std::map<Topic, int>> published; // map[client_id] => map[topic] = count
const char* lastPayload;
size_t lastLength;
void onPublish(const MqttClient* srce, const Topic& topic, const char* payload, size_t length)
{
if (srce)
published[srce->id()][topic]++;
lastPayload = payload;
lastLength = length;
}
test(local_client_should_unregister_when_destroyed)