Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
0beec2ce
Commit
0beec2ce
authored
Feb 23, 2015
by
Axel Auweter
Browse files
Properly handle malformed MQTT messages in CollectAgent.
parent
ca2f4ff8
Changes
1
Show whitespace changes
Inline
Side-by-side
CollectAgent/collectagent.cpp
View file @
0beec2ce
...
...
@@ -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
"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment