Commit 0beec2ce authored by Axel Auweter's avatar Axel Auweter
Browse files

Properly handle malformed MQTT messages in CollectAgent.

parent ca2f4ff8
......@@ -37,7 +37,6 @@ void sigHandler(int sig)
void mqttCallback(SimpleMQTTMessage *msg)
{
/*
* Increment the msgCtr/vmsgCtr for statistics.
*/
......@@ -73,6 +72,12 @@ void mqttCallback(SimpleMQTTMessage *msg)
//printf("Val = %" PRIu64 ", timestamp = %" PRIu64 "\n", val, ts);
}
//...otherwise this message is malformed -> ignore...
else {
delete msg;
return;
}
/*
* Check if we can decode the message topic
* into a valid SensorId. If successful, store
......@@ -97,7 +102,7 @@ void mqttCallback(SimpleMQTTMessage *msg)
#endif
mySensorDataStore->insert(&sid, ts, val);
}
#if 0
#if 1
else {
cout << "Wrong topic format: " << msg->getTopic() << "\n";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment